Search code examples
spring-data-elasticsearch

ElasticsearchRepository.refresh() is deprecated. What should I use?


I am migrating from spring data ES 4.1.15 to 4.4.1. The old code has below

ElasticsearchRepository.save()
ElasticsearchRepository.refresh()

What should I use to replace refresh?


Solution

  • Nothing. This was changed in version 4.2 (released in April 2021) and is described in https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch-migration-guide-4.1-4.2.breaking-changes.

    Doing a refresh is automatically done in repository methods, unless the user explicitly defines a refresh policy.