spring-data-elasticsearch

Elasticsearch Rest Client with Spring Data Elasticsearch

[亡魂溺海] 提交于 2019-11-29 16:50:50
问题 I am in a situation where I am using Spring boot and AWS elasticsearch service. AWS Elasticsearch service which only provides REST interface. Elasticsearch Rest Client is here. Simply, Is it possible to use REST client with Spring Data Elasticsearch? In other words, Does Spring Data Elasticsearch works with Elasticsearch Rest client? Spring Data Elasticsearch is very easy to use and template provides very most functionality that I need. With Elasicsearch Rest client I have to implement all

How to provide highlighting with Spring data elasticsearch

穿精又带淫゛_ 提交于 2019-11-29 04:07:51
问题 it seems that SpringData ES don't provide classes to fetch highlights returned by ES. Spring Data can return Lists of Objects but the highlights sections in the Json returned by ES is in a separated part that is not handled by the "ElasticSearchTemplate" class. Code example :- QueryBuilder query = QueryBuilders.matchQuery("name","tom"); SearchQuery searchQuery =new NativeSearchQueryBuilder().withQuery(query). with HighlightFields(new Field("name")).build(); List<ESDocument> publications =

Spring Data Elasticsearch @Document indexName defined at runtime

浪尽此生 提交于 2019-11-29 00:06:19
Is it possible to specify dynamically (at runtime) the indexName for each @Document , for example, via a configuration file? Or is it possible to make @Document Spring environment (dev, prod) dependant? Thank you! The @Document annotation does not permit to pass the indexname in parameter directly. However I found a work around. In my configuration class I created a Bean returning a string. In this string I injected the name of the index with @Value : @Value("${etrali.indexname}") private String indexName; @Bean public String indexName(){ return indexName; } Afterward it is possible to inject

Creating Indices name Dynamically in Elasticsearch using Spring-Data Elasticsearch

风流意气都作罢 提交于 2019-11-28 12:09:48
I have a use case where in need to create the indices per month in Elasticsearch. The idea is to create indices on the monthly bases so that they are easy to maintain and can be deleted when expired.For this to achieve i have used the spring-batch and have a monthly job which will create the indices on monthly bases For Elasticsearch-Java integration I have used the Spring-Data Elasticsearch implementation. The problem which i am facing now is, I am not able to figure out how to provide the dynamic-name to the index and mapping using the Entity object. My Current implementation is done keeping

Spring-Data-Elasticsearch settings: Spring can't find config file?

眉间皱痕 提交于 2019-11-28 11:50:09
With Spring-Data-Elasticsearch, I am trying to use analyzers and mappings defined in elasticsearch_config.json . This JSON file is in /src/main/resources folder. My JAVA model looks like: @Document(indexName = "test", type="Tweet") @Setting(settingPath = "/elasticsearch_config.json") public class Tweet { @Id private String idStr; /** other fields, getters and setters are omitted **/ } elasticsearch_config.json contains both settings and mappings: { "settings": { /* some filters */}, "mappings": { /* some types' mappings*/ } } I tried with curl, I get no problem indexing/searching. My problem :

Spring Data Elasticsearch @Document indexName defined at runtime

為{幸葍}努か 提交于 2019-11-27 15:10:43
问题 Is it possible to specify dynamically (at runtime) the indexName for each @Document , for example, via a configuration file? Or is it possible to make @Document Spring environment (dev, prod) dependant? Thank you! 回答1: The @Document annotation does not permit to pass the indexname in parameter directly. However I found a work around. In my configuration class I created a Bean returning a string. In this string I injected the name of the index with @Value : @Value("${etrali.indexname}")

Spring Data Elastic Search with Nested Fields and mapping

懵懂的女人 提交于 2019-11-27 11:21:01
问题 I am using spring-data-elasticsearch and elasticsearch together to query documents. I'd like to do nested queries on nested documents. I have this in java : @Document(indexName = "as", type = "a", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1") class A { @Id private String Id; @Field(type = String, index = analyzed, store = true) private String field1; // ... Many more Fields. @NestedField(type = FieldType.Object, index = analyzed, store = true, dotSuffix =