spring-data-elasticsearch

Only return specific fields in elastic search native query Java api

泄露秘密 提交于 2020-08-10 05:10:20
问题 I'm building a native query but I only want to return certain fields, all of which are held within a parent field. I think I am looking for the QueryBuilders or NativeSearchQueryBuilder equivalent of the REST API's _source. Here's a code example: NativeSearchQueryBuilder sb = new NativeSearchQueryBuilder() .withIndices("myIndex") .withTypes("myType") .withQuery(QueryBuilders.queryStringQuery("parent.field2:Foo*")); .withFields("parent.field1"); I'd expect this to return a list of only parent

Only return specific fields in elastic search native query Java api

时间秒杀一切 提交于 2020-08-10 05:10:00
问题 I'm building a native query but I only want to return certain fields, all of which are held within a parent field. I think I am looking for the QueryBuilders or NativeSearchQueryBuilder equivalent of the REST API's _source. Here's a code example: NativeSearchQueryBuilder sb = new NativeSearchQueryBuilder() .withIndices("myIndex") .withTypes("myType") .withQuery(QueryBuilders.queryStringQuery("parent.field2:Foo*")); .withFields("parent.field1"); I'd expect this to return a list of only parent

Trying to store and get some data using ElasticSearch

十年热恋 提交于 2020-08-10 01:15:26
问题 I have this small configuration using ElasticSearch, but since i want to store some data , i am getting the error below: with repository.save(new FileProperty("12dW", 123.123, "hii")); P.S. the elasticSearch is runing on the port 9200 using docker Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.elasticsearch.UncategorizedElasticsearchException: Elasticsearch exception [type

Trying to store and get some data using ElasticSearch

只谈情不闲聊 提交于 2020-08-10 01:12:51
问题 I have this small configuration using ElasticSearch, but since i want to store some data , i am getting the error below: with repository.save(new FileProperty("12dW", 123.123, "hii")); P.S. the elasticSearch is runing on the port 9200 using docker Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.elasticsearch.UncategorizedElasticsearchException: Elasticsearch exception [type

Spring Boot(2.2.X) - Spring Elastic Search(6.8.X) - Different JSONProperty and Field Name

别来无恙 提交于 2020-07-23 08:22:05
问题 Updated Spring boot to 2.2.X from 2.1.X and elastic search to 6.8.X from 6.3.X . Got mapping exception, to resolve Mapping exception, renamed document variable to myDocument. Now on elasticSearchRepo.SaveAll(objectTosave) value is not persisted in document. Other properties like id, category are present in the document. Is there any way to have different fieldName and jsonProperty? import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data