[英]Elasticsearch Spring Data with RestHighLevelClient
I don't understand the relationship between the High Level REST CLient (which replaces the Transport Client) and Spring Data Elasticsearch.我不明白高级 REST 客户端(取代传输客户端)和 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().有教程 ( https://www.baeldung.com/spring-data-elasticsearch-tutorial ) 展示了如何使用 getSomethingById() 等自动实现的方法进行 JPA 样式的查询。 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.但是
ElasticsearchRepository
似乎需要一个带有 ElasticsearchTemplate-Bean 的@Configuration
-Class 并且需要 TransportClient。 As far as I have tried out, there is no way of replacing it with the High/Low Level Java Rest Clients, no?据我尝试,没有办法用高/低级 Java Rest 客户端替换它,不是吗?
So if I want to use the newest official Client, there is no JPA-goodness for me?那么如果我想使用最新的官方客户端,对我来说没有JPA-goodness吗?
在Spring Data ES回购中有一个关于这个问题的公开问题: https : //jira.spring.io/browse/DATAES-407
spring-data-elasticsearch 3.2.0, now available as M2 contains the code to use the RestClient. spring-data-elasticsearch 3.2.0,现在可以作为M2包含使用RestClient的代码。
See my answer to this question: What Elasticsearch client does Spring-Data-Elasticsearch use under the hood? 请参阅我对这个问题的回答: Spring-Data-Elasticsearch使用Elasticsearch客户端做什么? for how to set it up
如何设置它
Spring Data Moore has been release including this feature (October 8 2019).This is the main description: Spring Data Moore 已发布包括此功能(2019 年 10 月 8 日)。这是主要描述:
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:如果您需要更多详细信息,您可以查看此 jira 问题:
https://jira.spring.io/browse/DATAES-407 for more detail https://jira.spring.io/browse/DATAES-407了解更多详情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.