spring-data-elasticsearch

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

一个人想着一个人 提交于 2020-07-23 08:21: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

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

China☆狼群 提交于 2020-07-23 08:20:20
问题 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

How to do source filtering in ElasticSearch in spring boot project?

徘徊边缘 提交于 2020-07-23 06:41:07
问题 how to make Elastic search query return only particular fields in spring boot project using spring-data-elasticsearch? we are using most recent versions of spring boot and elastic search. Which template to use elasticsearchtemplate or elasticsearchresttemplate and how both of them are different from java high level rest client? 回答1: If you are using the ElasticsearchOperations interface (which ElasticsearchTemplate and ElasticsearchRestTemplate implement), the Query interface that is used to

How to do source filtering in ElasticSearch in spring boot project?

孤者浪人 提交于 2020-07-23 06:40:20
问题 how to make Elastic search query return only particular fields in spring boot project using spring-data-elasticsearch? we are using most recent versions of spring boot and elastic search. Which template to use elasticsearchtemplate or elasticsearchresttemplate and how both of them are different from java high level rest client? 回答1: If you are using the ElasticsearchOperations interface (which ElasticsearchTemplate and ElasticsearchRestTemplate implement), the Query interface that is used to

Get all non-full fields in ElasticsearchRepository's findAll method in Spring Data Elasticsearch

亡梦爱人 提交于 2020-07-14 12:20:23
问题 We are using we're using spring-data-elasticsearch 3.2.6.RELEASE and here is our repository : @Repository public interface IRepository extends ElasticsearchRepository<User, Integer> { List<User> findAll(); } and here is the sample response: [{ "idDl": null, "clientName": null, "Address": null }, { "idDl": 19810008, "clientName": "ABC", "Address": "NYC" }] And we have our own custom implementation to return all values excluding certain fields, as follows: It is exposed as separate REST point.

Elasticsearch for multiple language support

情到浓时终转凉″ 提交于 2020-07-11 06:10:28
问题 I am using elasticsearch 5.1.1. I have a requirement where in I want to index data in multiple languages. I used following mapping: PUT http://localhost:9200/movies { "mappings": { "title": { "properties": { "title": { "type": "string", "fields": { "de": { "type": "string", "analyzer": "german" }, "en": { "type": "string", "analyzer": "english" }, "fr": { "type": "string", "analyzer": "french" }, "es": { "type": "string", "analyzer": "spanish" } } } } } } } when I try to insert some data as :

Elasticsearch for multiple language support

五迷三道 提交于 2020-07-11 06:08:45
问题 I am using elasticsearch 5.1.1. I have a requirement where in I want to index data in multiple languages. I used following mapping: PUT http://localhost:9200/movies { "mappings": { "title": { "properties": { "title": { "type": "string", "fields": { "de": { "type": "string", "analyzer": "german" }, "en": { "type": "string", "analyzer": "english" }, "fr": { "type": "string", "analyzer": "french" }, "es": { "type": "string", "analyzer": "spanish" } } } } } } } when I try to insert some data as :

Elasticsearch for multiple language support

ε祈祈猫儿з 提交于 2020-07-11 06:07:17
问题 I am using elasticsearch 5.1.1. I have a requirement where in I want to index data in multiple languages. I used following mapping: PUT http://localhost:9200/movies { "mappings": { "title": { "properties": { "title": { "type": "string", "fields": { "de": { "type": "string", "analyzer": "german" }, "en": { "type": "string", "analyzer": "english" }, "fr": { "type": "string", "analyzer": "french" }, "es": { "type": "string", "analyzer": "spanish" } } } } } } } when I try to insert some data as :

Can't count the occurences of the entity with a field of particular value inside a nested property using Spring Data ElasticSearch Repository

我们两清 提交于 2020-06-29 04:36:05
问题 I have the Article entity and inside it there is a nested property, let's say Metadata . I need to count all articles, which have a particular field inside this nested property, let's say indexed , assigned to e.g. 1. Java Document Snippet: @Document(indexName = "article", type = "article", useServerConfiguration = true, createIndex = false) @Setting(settingPath = "/mappings/settings.json") @Mapping(mappingPath = "/mappings/articles.json") public class Article { // getters and setters, empty

spring-data-elasticsearch and update

我的梦境 提交于 2020-06-12 20:36:27
问题 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()