FAQ Database Discussion Community


Spring data ElastiSearch aggregations with filters

java,spring,elasticsearch,spring-data-elasticsearch
I am trying to perform aggregations on values filtered by some conditions. I am using ElasticSearchTemplate.query() method of spring data too execute query and get the results in result extractor. I am getting the hits correctly (i.e. filters are applied and docs matching those values are only retrieved.). However, aggregations...

How to enable query logging in Spring-data-elasticsearch

java,elasticsearch,spring-data-elasticsearch
I use spring-data-elasticsearch framework to get query result from elasticsearch server, the java code like this: SearchQuery searchQuery = new NativeSearchQueryBuilder() .withQuery(matchAllQuery()).withSearchType(SearchType.COUNT) .addAggregation(new MinBuilder("min_createDate").field("createDate")) .build(); List<Entity> list = template.queryForList(searchQuery, Entity.class); While how can I know the raw http query sent to elasticssearch server? How can I enable the logging, I...

Elasticsearch multiple values match without analyzer

java,elasticsearch,spring-data-elasticsearch
Pardon my knowledge on ElasticSearch. I have an Elasticsearch collection which has documents like these: { "date": "2013-12-30T00:00:00.000Z", "value": 2, "dimensions": { "region": "Coimbra District" } } { "date": "2013-12-30T00:00:00.000Z", "value": 1, "dimensions": { "region": "Federal District" } } { "date": "2013-12-30T00:00:00.000Z", "value": 1, "dimensions": { "region": "Masovian Voivodeship" }...

Aggregation Support for Spring Data Elastic Search

spring-data-elasticsearch
Elastic search has deprecated Facets and recommend to use Aggregations (http://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-aggregations.html) . Is Spring Data Elastic Search supports this currently ? If Yes, is there any Samples available ?...

Elasticsearch NumberFormatException when running two consecutive java tests

java,date,elasticsearch,numberformatexception,spring-data-elasticsearch
I have two test in a class, each of them containing the following query: SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withFilter(rangeFilter("publishDate").lt(date)).build(); In one of the tests, the number of the results elasticsearchTemplate.count(searchQuery, Article.class), in the other one the returned values are verified elasticsearchTemplate.queryForPage(searchQuery,Article.class) If I run any of these two tests separately,...

Elasticsearch Aggregation by Day of Week and Hour of Day

elasticsearch,nosql,elasticsearch-plugin,spring-data-elasticsearch,pyelasticsearch
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...

Obtaining string query (JSON) from SearchQuery object

elasticsearch,spring-data,spring-data-elasticsearch
For debugging purposes, I need to know what query spring-data-elasticsearch is sending to the ElasticSearch cluster. I have tried to call the toString method on the SearchQuery object, and doesn't return what I need. What I am doing in Java (using spring-data-elasticsearch) is: private FilterBuilder getFilterBuilder(String id) { return orFilter(...

Spring-data-elasticsearch nested query not working

java,elasticsearch,spring-data-elasticsearch
Person.java @Document(indexName = "person", type = "user") public class Person { @Id private String id; @Field(type = FieldType.String) private String name; @Field(type = FieldType.Nested) private List<Car> cars; // getter/setter } Car.java public class Car { @Field(type = FieldType.String) private String name; @Field(type = FieldType.String) private String model; // getter/setter }...

Spring data elasticSearch returns null with findOne

spring,elasticsearch,spring-data-elasticsearch
I'm testing Spring data with elasticSearch. The ES server is running on a remote server in tha same room. I have one index created a day, under an alias. I'm trying to find a simple tweet. But when I try a findOne(), it doesn't seem to work because it returns...