spring-data-elasticsearch

ElasticSearch Indexing Key/Value Map

懵懂的女人 提交于 2019-12-08 07:33:28
问题 I'm using elasticsearch as indexing engine in my java project. I'm asking if there is anyway to index a java.util.Map a key/value Map. For example i have this java class: public class NextEvent extends NewtonResource{ private Map<String, String> metadata; private Instant executionDate; private String type; protected Boolean executed; private List<PatchOperation> jsonPatch; private List<String> crons; ... } I want to create an elasticsearch mapping including the Map of metadata variable.

How to search inside all types in elastic index using spring data elasticsearch

被刻印的时光 ゝ 提交于 2019-12-08 03:22:28
I'm building a search application in which I will have to search inside all types in specified index and specific type in specified index. Am using spring data elasticsearch as my java client for elasticsearch. But am getting no hits in the case where I have to search whole of the index(all types). Code snippets used for search :- Whole index(Returns 0 hits) :- SearchQuery searchQuery = new NativeSearchQueryBuilder() .withIndices(<index_name>) .withQuery(finalQuery) .withHighlightFields(field).build(); Inside specific type :- SearchQuery searchQuery = new NativeSearchQueryBuilder()

Spring Boot 2.0.0.M2 and Spring Data Elasticsearch configuration

安稳与你 提交于 2019-12-07 13:30:52
问题 I'm trying to move my project to Spring Boot 2.0.0.M2 . This is my old Spring Data Elasticsearch configuration: import org.elasticsearch.client.Client; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context

How to modeling when use Spring data mongo and Spring data elasticearch?

喜夏-厌秋 提交于 2019-12-07 10:25:14
问题 I want to use mongo and ElasticSearch in my projects, and I also like adopt Spring Data Mongo and Spring Data ElasticSearch, but both has their Repository and model specs, how to use them together? There are some options: Use the same model class for Mongo and ElasticSearch? @Document//from Spring Data Mongo @Document// from Spring Data ElasticSearch public class Book{ @Id//Spring Data Commons private String id; } But there are some mismatch in Spring Data Mongo and Spring Data ElasticSearch,

NPE while executing Update By Query in Elasticsearch using Java

孤者浪人 提交于 2019-12-06 09:30:25
I'm using Elasticsearch 2.4 in a Spring Boot application and I need to execute _update_by_query request to the remote ES instance using Java API. I've found the way to accomplish this task at this question , but as for my case I've got an NPE trying to execute the .get() function. A module for ES included: compile 'org.elasticsearch.module:reindex:2.4.1' Here's a code snippet I use for testing right now: UpdateByQueryRequestBuilder request = UpdateByQueryAction.INSTANCE.newRequestBuilder(clientWrapper.getClient()); // clientWrapper is a bean and gets injected Script script = new Script( "ctx.

Elasticsearch Aggregation by Day of Week and Hour of Day

十年热恋 提交于 2019-12-06 07:04:34
I have documents of type: [{"msg":"hello", date: "some-date"},{"msg":"hi!", date: "some-date"}, ... I want to have the count of documents by day of week. For example x messages were sent on Monday and y were sent on Tuesday and so on. I have used date_histogram with aggregation but it returns me the documents day wise. It does return me the day, but say "Wed, 22" and "Wed, 29" are returned as separate aggregation documents. This is somewhat related to Elasticsearch - group by day of week and hour but there is no answer to that question so I am reposting it. According to the suggestion there it

How to make elasticsearch embedded accessible via localhost:9200

折月煮酒 提交于 2019-12-05 17:27:18
问题 I am playing with spring-boot-sample-data-elastcisearch project. I've changed the pom and added: SampleElasticsearchApplicationWebXml extends SpringBootServletInitializer to run with Tomcat embedded. My application.properties has spring.data.elasticsearch.http-enabled=true spring.data.elasticsearch.local=true I want to be able to connect to localhost:9200 in order to use elasticsearch-head or other JS client. What am I missing? Thanks, Milan 回答1: you should define this for yourself, because

Refreshing the ElasticSearch index from RDBMS using Spring Data

我怕爱的太早我们不能终老 提交于 2019-12-05 15:39:42
I have the following setup : Mysql RDBMS server Elastic Search Server My requirement is to copy data periodically from MYSQL RDBMS and update Elastic server with it.Currently i am following the approach below : A Batch Job which reads all data from MYSQL using Spring Data Jpa It then pushes all data to elastic server using spring data elastic This approach is very cumbersome and not efficient.Is there a way where i can read only the updated values using spring data and update the index accordingly in elastic. Using jdbc-river etc is not an option for me as the application uses Spring data

How to modeling when use Spring data mongo and Spring data elasticearch?

泄露秘密 提交于 2019-12-05 14:50:28
I want to use mongo and ElasticSearch in my projects, and I also like adopt Spring Data Mongo and Spring Data ElasticSearch, but both has their Repository and model specs, how to use them together? There are some options: Use the same model class for Mongo and ElasticSearch? @Document//from Spring Data Mongo @Document// from Spring Data ElasticSearch public class Book{ @Id//Spring Data Commons private String id; } But there are some mismatch in Spring Data Mongo and Spring Data ElasticSearch, such as Geo field type. Define different model for Mongo and ElasticSearch, and copy data state from

Spring Elastic Search Custom Field names

时光毁灭记忆、已成空白 提交于 2019-12-05 03:51:33
I am new to Elastic Search and I am trying to implement it using Spring-data-elasticsearch. I have fields with names such as "Transportation", "Telephone_Number" in our elastic search documents. When I try to map my @Domain object fields with those, I don't get any data for those as I couldn't successfully map those fields. Tried to use @Field, was disappointed as it didn't have 'name' property in it to map with custom field name. Tried different variations of a GETTER function, none of those seem to be mapping to those fields. I started wondering if there's something I'm missing here. How