10

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?

Devkinandan Chauhan
  • 1,785
  • 1
  • 17
  • 42
  • 1
    Others stumbling into this question may ask 'What about *Jest*'? Well, the [Jest project](https://github.com/searchbox-io/Jest) unfortunately is no longer being actively developed. – Paulo Merson Oct 04 '22 at 14:48

1 Answers1

10

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.

Amit
  • 30,756
  • 6
  • 57
  • 88
  • which one would be better if i consider points like performance, future upgrade of ES version etc...? – Devkinandan Chauhan Jun 15 '20 at 06:40
  • 1
    @DevChauhan IMHO you should directly use the rest-high level java client so that you don't have to wait till spring data release the integration with new versions, also performance shouldn't be the issue but still having an abstraction might make it difficult and add obliviously some overhead although don't think it would be too much – Amit Jun 15 '20 at 08:15
  • @DevChauhan hope I answered your question, let me know if you need more info – Amit Jun 15 '20 at 08:53
  • 1
    @DevChauhan sure, just one question based on this question is that now you will not have spring data dependency correct as I explained its better to use the rest-high level client directly which I hv been using in my projects and never faced many issues while upgrading, also please keep in mind that elasticsearch is evolving very fast and ES 8 will have again quite some breaking changes, it will remove the support of `type` permanently, so it would be great if you can provide your use cases also in the question otherwise I;ll give general ans inst of specific while ans, hope you got my point. – Amit Jun 15 '20 at 11:37