spring-data-elasticsearch

Spring Data Elasticsearch's ElasticsearchTemplate vs ElasticsearchRepository

二次信任 提交于 2021-02-18 21:32:09
问题 I am in reference to Spring Data Elasticsearch's org.springframework.data.elasticsearch.repository.ElasticsearchRepository org.springframework.data.elasticsearch.core.ElasticsearchTemplate It seems they are two different APIs that achieve the same goal but I am not sure what the differences are between those two types and more importantly when to use which. Can someone please provide advice and guidance? 回答1: ElasticsearchRepository is intended to be used as a repository for your domain

configure spring.codec.max-in-memory-size When using ReactiveElasticsearchClient

北城余情 提交于 2021-02-16 10:07:19
问题 I am using the ReactiveElasticsearchClient from spring-data-elasticsearch 3.2.3 with spring-boot 2.2.0. When upgrading to spring-boot 2.2.2 i have got org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144. It's indicated to fixe that to use spring.codec.max-in-memory-size but i still got the same exception. Bellow the whole exception: org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer :

configure spring.codec.max-in-memory-size When using ReactiveElasticsearchClient

China☆狼群 提交于 2021-02-16 10:06:21
问题 I am using the ReactiveElasticsearchClient from spring-data-elasticsearch 3.2.3 with spring-boot 2.2.0. When upgrading to spring-boot 2.2.2 i have got org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144. It's indicated to fixe that to use spring.codec.max-in-memory-size but i still got the same exception. Bellow the whole exception: org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer :

java.lang.NoSuchMethodError: org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder.setSource

…衆ロ難τιáo~ 提交于 2021-02-11 15:15:23
问题 I am trying to run the spring boot parent project which uses child project, which in turn uses project(ES project) which has elasticsearch dependencies and elasticsearch config bean for transport client. The child project uses Spring Data ES repositories, which are enabled by a respective annotation in a project. These are config annotations used in the child: @Configuration @ComponentScan("package") @EntityScan("package3") @EnableJpaRepositories("package2") // enables only es repos for

Spring data elasticsearch multiple filters

混江龙づ霸主 提交于 2021-02-11 14:33:28
问题 Considering the mappings (messages are nested type inside channel) @Document(indexName = "index", type = "channel") @Data public class Channel { @Id @Field(type = FieldType.Text) private String id; @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second_millis) @JsonFormat(shape = JsonFormat.Shape.STRING) private LocalDateTime issuedTimestamp; @Field(type = FieldType.Text) private String clientUsername; @Field(type = FieldType.Nested, includeInParent = true) private List

Elastic Search Query for Distinct Nested Values

好久不见. 提交于 2021-02-11 14:32:34
问题 I am using the High Level REST Client for Elastic Search 6.2.2. Suppose that I have two documents in index "DOCUMENTS" with type "DOCUMENTS" that are { "_id": 1, "Name": "John", "FunFacts": { "FavColor": "Green", "Age": 32 } }, { "_id": 2, "Name": "Amy", "FunFacts": { "FavFood": "Pizza", "Age": 33 } } I want to find out all of the distinct fun facts and their distinct values, ultimately returning an end result of { "FavColor": ["Green"], "Age": [32, 33], "FavFood": ["Pizza"] } It is ok for

Creating Indexname Dynamically using Spring-Data Elasticsearch with @Document

大城市里の小女人 提交于 2021-02-07 20:14:11
问题 I am trying to get indexname dynamically in @Document(indexName="Something",type="type") I have tried using below code: @Document(indexName="#{systemProperties['databaseName'] }", type = "dbtype") but at runtime when I am sending two request from UI to get the data from ES from different indexes,it is not working properly. what should I do to solve this issue? 回答1: A workaround is, to work with NativeSearchQuerries. There you can set the index to whatever you like: NativeSearchQuery query =

elasticsearch dynamic query - Add another field to each document returned

谁都会走 提交于 2021-02-06 09:26:07
问题 What I need is very simple, but I am unable to find how to do it in Elasticsearch, possibly because of the complexity of what is required to be done. Input (two sample JSON documents) { "car" : 150, "bike" : 300 } { "car" : 100, "bike" : 200} What I want in return is that when I fire a search query it returns me the documents with an extra field inventory which is defined as the sum of number of cars and bikes. And in the sorted order. Sample Output: hits: [ { "car" : 150, "bike" : 300,

The Best way to use ElasticSearch in Spring java framework

落爺英雄遲暮 提交于 2021-02-05 13:15:12
问题 I'm developing a system which is planning to use elasticsearch as an data repository. I'm trying to choose the best way to develop my application that can index and query data from elasticsearch. The system I have is built on top of Spring framework. Is it a good choice to use Spring-data-elasticsearch (https://github.com/spring-projects/spring-data-elasticsearch)? Or is it a good choice to use elasticsearch core libraries itself ? I need to handle nested data (inner object) but Spring-data

The Best way to use ElasticSearch in Spring java framework

余生颓废 提交于 2021-02-05 13:11:28
问题 I'm developing a system which is planning to use elasticsearch as an data repository. I'm trying to choose the best way to develop my application that can index and query data from elasticsearch. The system I have is built on top of Spring framework. Is it a good choice to use Spring-data-elasticsearch (https://github.com/spring-projects/spring-data-elasticsearch)? Or is it a good choice to use elasticsearch core libraries itself ? I need to handle nested data (inner object) but Spring-data