Simple aggregation using java API - elastic 1.x

(Mmaia) #1

I am new to aggregations with Elastic Search and have been stuck for a couple of hours with this very simple example taken from this link:

Basically I am trying to do the java api version of this very simple working aggregation:

 "aggs" : {
   "colors" : {
       "terms" : {
           "field" : "color"

and this is the java version I am trying to build but it returns empty buckets:

SearchResponse sr = client

while using the elastic DSL I get a proper resopnse with buckets grouped by colors but with the java version I get an empty bucket.

(Mmaia) #2


java code is working, my issue was related to using this code in unit testing and for some reason had bad results, when used against a running elastic cluster the code works fine.
I've tried to delete the question but couldn't find the option.

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.