8

I don't understand the relationship between the High Level REST CLient (which replaces the Transport Client) and Spring Data Elasticsearch.

There are tutorials (https://www.baeldung.com/spring-data-elasticsearch-tutorial) showing how to make JPA-style queries with auto-implemented methods like getSomethingById(). They utilize this interface:

public interface ElasticsearchRepository<T, ID extends Serializable> extends ElasticsearchCrudRepository<T, ID> {

But ElasticsearchRepository seems to require a @Configuration-Class with an ElasticsearchTemplate-Bean and that requires the TransportClient. As far as I have tried out, there is no way of replacing it with the High/Low Level Java Rest Clients, no?

So if I want to use the newest official Client, there is no JPA-goodness for me?

Phil
  • 7,065
  • 8
  • 49
  • 91
  • There's an open issue regarding this in the Spring Data ES repo: https://jira.spring.io/browse/DATAES-407 – Val Aug 15 '18 at 05:16
  • @Val Thank you very much! I also appreciated your answer for this question: https://stackoverflow.com/questions/49172625/spring-data-elastic-search-with-java-high-level-rest-client Really useful information there! – Phil Aug 15 '18 at 07:00
  • @Val can you please post your comment as answer. I'm tired of reading questions that are already answered in the comments. – Simon Martinelli Aug 15 '18 at 07:05

3 Answers3

5

There's an open issue regarding this in the Spring Data ES repo: https://jira.spring.io/browse/DATAES-407

Val
  • 207,596
  • 13
  • 358
  • 360
1

spring-data-elasticsearch 3.2.0, now available as M2 contains the code to use the RestClient.

See my answer to this question: What Elasticsearch client does Spring-Data-Elasticsearch use under the hood? for how to set it up

P.J.Meisch
  • 18,013
  • 6
  • 50
  • 66
0

Spring Data Moore has been release including this feature (October 8 2019).This is the main description:

Elasticsearch: High Level REST Client support & non Jackson based entity mapping

If yo need more detail You will be able to have a look to this jira issue:

https://jira.spring.io/browse/DATAES-407 for more detail

CRISTIAN ROMERO MATESANZ
  • 1,502
  • 3
  • 14
  • 26