Search code examples
springspring-dataspring-data-elasticsearch

ReactiveSortingRepository Elasticsearch Use Alias for findBy


I am using ReactiveSortingRepository for getting documents from Index using findBy... methods and this works perfectly fine. It fetches documents from the Index. Is it possible to use an alias instead of directly fetching from Index with ReactiveCrudRepository or ReactiveSortingRepository? I did not find anything in the documentation. Better still would be to have selective methods use an alias. For example, all the findBy methods using an alias and delete using an index which is the default


Solution

  • No, this is not possible. The repository implementation uses the name that is defined in the @Document annotation in the entity. It does not differentiate between reading an writing access.