spring-data-elasticsearch

Compatible versions of Spring boot,elasticsearch and spring data elasticsearch

倾然丶 夕夏残阳落幕 提交于 2019-12-20 01:59:14
问题 I have been developing a simple java programming using spring boot,elastic search and spring data elastic search. I am able to do the elastic search successfully with below versions 1) spring boot 1.3.5 2) spring-data-elasticsearch 1.3.4.RELEASE 3) elasticsearch 1.3.2 but when i upgraded to the below versions,one of my service class annotated with @service annotation showing error as "The type org.elasticsearch.search.suggest.SuggestBuilder$SuggestionBuilder cannot be resolved. It is

Creating Indices name Dynamically in Elasticsearch using Spring-Data Elasticsearch

ⅰ亾dé卋堺 提交于 2019-12-17 20:57:18
问题 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

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

自闭症网瘾萝莉.ら 提交于 2019-12-17 20:16:00
问题 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

searching a specific field in elasticsearch through Spring data elasticsearch

自古美人都是妖i 提交于 2019-12-13 07:08:08
问题 I'm using Spring data Elasticsearch to parse data in ELasticseach . I have already there an indexed element ( elastalert ) witch contains the alert_sent property. So what i want to do is returning all alerts that were sent to the admin. I tried defining a method in the Repository List<Alert> findByAlert_sentTrue() but it seems that the underscore is a problem (as mentioned in the documentation http://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#repositories.query

How to query Elastic with Spring-data-elastic

做~自己de王妃 提交于 2019-12-12 19:19:01
问题 I am new to Elastic and spring-data-elastic. I am been searching here and other areas of the web, but so far have been unable to find the answer to my question. I am hoping SO might be able to help. I am indexing some records from my Users table (firstName, lastName) and I am looking to be able to allow advanced searching. So for example if I have the name 'Frances' and I enter 'Frank' then the system is smart enough to return the record. Same for 'Robinson' and 'Robinsen', etc. I've setup my

Is there a way to specify write consistency level when using spring data's ElasticSearchTemplate?

强颜欢笑 提交于 2019-12-12 04:28:56
问题 when using the elastic search java client it is possible to specify the write consistency level and timeout for each query: final IndexRequestBuilder indexRequestBuilder = client.prepareIndex("myIndex", "myType"); indexRequestBuilder.setConsistencyLevel(WriteConsistencyLevel.ALL); indexRequestBuilder.setTimeout(TimeValue.timeValueMillis(500)); final XContentBuilder sourceBuilder = ..... indexRequestBuilder.setSource(sourceBuilder).execute().actionGet(); I did not find an API to do the same

Spring data elasticsearch fails to initialze the elasticsearchtemplate

早过忘川 提交于 2019-12-12 03:45:43
问题 I am using spring-data-elasticsearch 2.0.0 RELEASE and ElasticSearch 2.2.0 I have setup my beans as follows: @Configuration public class ElasticSearchClient { @Autowired private ElasticSerachConfig esConfig; static final String COLON = ":"; static final String COMMA = ","; private Settings getSettings(){ return Settings.builder() .put("client.transport.sniff", esConfig.isClusterSniff()) .put("client.transport.ping_timeout", esConfig.getClientPingTimeout()) .put("client.transport.nodes_sampler

Elasticsearch to query across multiple indices and multiple types

旧街凉风 提交于 2019-12-12 02:08:14
问题 I am newbie to elasticsearch .I am using AWS elastic search instance 5.1.1. I have a requirement where I need to specify multiple indices and types in request body of Elasticsearch for search operation ,is it possible ? What is the simplest way to do it an example would be appreciated. Thanks in advance ! 回答1: Referring back to documentation you can try doing a simple CURL as below curl -XGET 'localhost:9200/_search?pretty' This should ideally query across all indices and types. Hope This

control elasticsearch configuration in spring-data setup

十年热恋 提交于 2019-12-12 02:03:58
问题 I startup elasticsearch via XML configuration like this: <elasticsearch:node-client id="client" local="true"/> Now I need more control on configuration e.g. setting the index files location. How can I achieve this? Can I pass parameter somehow or do I need to specify a config-file location using environment property -Des.config= ? 回答1: You need to use @Setting(settingPath = "elasticsearch.properties") in your config class and inside the file set the path.data property. Check my answer here 来源

Why can't I query correctly against a HashMap field in Elasticsearch?

爷,独闯天下 提交于 2019-12-12 00:29:19
问题 I am using Elasticsearch v1.5.2. I have a JSON document that looks like the following. { "id": "RRRZe32", "metadata": { "published": "2010-07-29T18:11:43.000Z", "codeId": "AChdUxnsuRyoCo7roK6gqZSg", "codeTitle": "something" } } My Java POJO object that backs this JSON looks like the following. Note that I am using Spring-Boot v1.3.0.M2 with spring-boot-starter-data-elasticsearch dependency. @Document(indexName="ws", type="vid") public class Video { @Id private String id; @Field(type=FieldType