spring-data-elasticsearch

spring-data-elasticsearch and update

安稳与你 提交于 2020-06-12 20:35:14
问题 i'm using spring-data-elasticsearch to do CRUD operations. I have a custom Repository that extends ElasticsearchRepository. Ultimately ElasticsearchRepository extends CrudRepository which implies updating an existing record is possible. The question is, how do you accomplish this? I haven't found a method called "update()" I thought doing the following would work (code stolen from https://github.com/BioMedCentralLtd/spring-data-elasticsearch-sample-application) //create Book book = new Book()

spring-data-elasticsearch and update

梦想与她 提交于 2020-06-12 20:34:17
问题 i'm using spring-data-elasticsearch to do CRUD operations. I have a custom Repository that extends ElasticsearchRepository. Ultimately ElasticsearchRepository extends CrudRepository which implies updating an existing record is possible. The question is, how do you accomplish this? I haven't found a method called "update()" I thought doing the following would work (code stolen from https://github.com/BioMedCentralLtd/spring-data-elasticsearch-sample-application) //create Book book = new Book()

ElasticSearch Java Client querying nested objects

喜你入骨 提交于 2020-05-25 05:12:19
问题 How do I convert this kind of query. { "query": { "nested": { "path": "consultations", "query": { "bool": { "must": [ { "match": { "consultations.prescriptions": "alfuorism" } }, { "match": { "consultations.Diagnosis": "Fever" } } ] } } } } } To a Java Client query using QueryBuilders 回答1: The folowing Java code will generate your query public NestedQueryBuilder nestedBoolQuery(final Map<String, String> propertyValues, final String nestedPath) { BoolQueryBuilder boolQueryBuilder =

How to Store Distance value to SortValues or Entity

孤街浪徒 提交于 2020-05-17 05:44:20
问题 How to Store Distance value to SortValues or Entity using SDE4.0 @Query, and SearchHit "sort": [ { "_geo_distance" : { "codenames.geoLocation" : [ { "lat" : 32.846027, "lon" : -96.84987 } ], "unit" : "mi", "order" : "asc", } } ] 回答1: You have to add a Sort parameter t your repository query, see the documentation for Spring Data Elasticsearch 4 where this is described. In your case you'd need: Sort sort = Sort.by( new GeoDistanceOrder("geoLocation", new GeoPoint(32.846027, -96.84987))

Need to write a custom analyzer for ElasticsearchRepository findBy query

我们两清 提交于 2020-04-18 03:49:23
问题 I have an ES collection with following doc schema. ` public class Address { @Id private String id; private String name; private String type; private String city; } ` My repository looks like as follows: public interface NetworkElementsESRepository extends ElasticsearchRepository<Address, String> { Address findByNameAndCity(String name, String city);} I need to fetch all addresses with name= "B00/A3K/24" in a particular city using following Query. addressRepo.findByNameAndCity(Name,City) . I

Elasticsearch analizer working when created throw Springdata but failing when creating straight from Postman/curl

拟墨画扇 提交于 2020-04-17 18:14:58
问题 Goal: create Elasticsearch index aimed to be loaded with 10 million simple documents. Each document is basically "Elastisearch id", "some company id" and "name". Provide search-as-suer-type feature. I could created successfully an index and an analyzer either straight from Postman (curl or any other tool not relying on Spring Data) or during Spring boot initialization. Nevertheless, when I try to use the analizer it seems it is ignored for the one created straight from Postman. So my main

Elasticsearch analizer working when created throw Springdata but failing when creating straight from Postman/curl

十年热恋 提交于 2020-04-17 17:57:54
问题 Goal: create Elasticsearch index aimed to be loaded with 10 million simple documents. Each document is basically "Elastisearch id", "some company id" and "name". Provide search-as-suer-type feature. I could created successfully an index and an analyzer either straight from Postman (curl or any other tool not relying on Spring Data) or during Spring boot initialization. Nevertheless, when I try to use the analizer it seems it is ignored for the one created straight from Postman. So my main

Spring Data Elastic - Java.Time.Instant class Jackson deserliization not working

安稳与你 提交于 2020-03-05 00:25:31
问题 Following is my WorkroomDTO: @NotNull private Instant createdOn; @JsonInclude(JsonInclude.Include.NON_NULL) private Instant changedOn; As you can see i am using Java 8 Instant class. In the elasticsearch Index server i store the following as JSON: "createdOn": { "nano": 877000000, "epochSecond": 1579861613 }, "changedOn": { "nano": 920000000, "epochSecond": 1579861613 }, The problem is when i query the elasticsearch server to get me the workroom return elasticsearchOperations.queryForPage(new

Spring-Data-Elastic Search and Spring-Data-Cassandra Having Issues with MapId

谁说胖子不能爱 提交于 2020-03-03 07:45:06
问题 I am trying to have Spring-Data-Cassandra and Spring-Data-Elasticsearch work together. Below is the problem which I am facing. org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personRepository': Invocation of init method failed; nested

How to search for a part of a word with spring data elasticSearch

送分小仙女□ 提交于 2020-01-24 23:07:12
问题 In my Spring Data Elasticsearch application I'd like to implement autocomplete functionality when user types a few chars and application will show him all possible variants with query* . Right now I can't find a way how to properly implement it with Spring Data Elasticsearch. For example I tried the following: Criteria c = new Criteria("name").startsWith(query); return elasticsearchTemplate.queryForPage(new CriteriaQuery(c, pageRequest), ESDecision.class); It works for a single word query but