I am trying to use histogram aggregation to create buckets.
setAggregations(Map aggregations) method of SearchRequestBuilder is not working as expected.
The parameter I am passing to the method is a map, where a single entry is of the form
MUST, ImmutableList.<Map<String, Object>>builder()
HISTOGRAM, ImmutableMap.<String, Object>of(
"min_doc_count" , 0)));
So the Map aggregations parameter is a map of the form [(field1,map1),(field2,map2),(field3,map3)] and so on where map1, map2 etc have filters and aggregate query defined for different fields.
This works fine for most of the indexes, but for few indexes there are no buckets returned upon execution of the query. I have checked the mappings of both indexes and they are exactly identical.
When I use aggregation builders in this scenario (addAggregation method) , it works fine for all indexes. But the problem with aggregation builders is that I will have to call it everytime for each field. setAggregtions is very useful for scenarios where we need to pass all the aggregations for all fields together in a single request to elasticsearch.
The biggest doubt I am having is that why setAggregation is not working for few indexes. I can clearly see the fields with their values but no bucket is getting created.
Any leads regarding this would be really useful.
My elasticsearch version is 1.7