Skip to content

Reactive save does not apply the custom id conversion #3359

Closed

Description

@chuuminggg

The reactive template does not apply the registered id conversion when it saves an entity, while the reactive read and delete operations do. The imperative template converts the id in all three cases.

AbstractReactiveElasticsearchTemplate.getIndexQuery(Object) sets the id with id.toString():

query.setId(id.toString());

AbstractElasticsearchTemplate.getIndexQuery(T) uses elasticsearchConverter.convertId(id), and so do the reactive findById (SimpleReactiveElasticsearchRepository) and delete(entity).

Steps to reproduce

  1. Use an entity whose @Id is a custom type, for example record ProductId(String value).
  2. Register a Converter<ProductId, String> (returning value) and its reading counterpart in ElasticsearchCustomConversions.
  3. With a ReactiveElasticsearchRepository<Product, ProductId>, call save(new Product(new ProductId("abc"), ...)), then findById(new ProductId("abc")).

Expected

The document is stored with _id abc and findById returns it, as with the imperative repository.

Actual

The document is stored with _id ProductId[value=abc]. findById and deleteById look up abc and do not find it.

The fix would be to use converter.convertId(id) in the reactive getIndexQuery, which also covers save(Flux) and saveAll. I'd like to submit a PR with a unit test and imperative/reactive repository integration tests, if that's fine.

Activity

  1. added a commit that references this issue on Oct 16, 2026
  2. added
    type: bug
    and removed
    status: waiting-for-triage
    on Oct 19, 2026
  3. added a commit that references this issue on Oct 25, 2026
    dbc0e65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions