Search code examples
javaspring-bootmavenelasticsearchelasticsearch-high-level-restclient

Spring Data Elastic Search vs Java High Level REST Client


I'm new to Elastic search. We are building a Spring boot application with Elastic search.

For integrating my Spring boot application either we can use elasticsearch-rest-high-level-client or spring-boot-starter-data-elasticsearch.

Can anyone please elaborate on which option would be overall better and why?


Solution

  • spring-boot-starter-data-elasticsearch internally can use the transport(soon to be deprecated in ES 8.X) or rest-high-level-client Please refer elasticsearch client section for more information and how to configure them.

    And from the same link :

    Spring data Elasticsearch operates upon an Elasticsearch client that is connected to a single Elasticsearch node or a cluster. Although the Elasticsearch Client can be used to work with the cluster, applications using Spring Data Elasticsearch normally use the higher level abstractions of Elasticsearch Operations and Elasticsearch Repositories.

    Bottom line is that you can directly use rest-high-level client in your spring boot application but if you want more abstraction then you can use the spring-boot-starter-data-elasticsearch dependency and use its method which provides more abstraction although internally it would use the client offered by Elasticsearch.