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: https://www.elastic.co/guide/en/elasticsearch/guide/1.x/_aggregation_test_drive.html
Basically I am trying to do the java api version of this very simple working aggregation:
http://localhost:9200/cars/transactions/_search?search_type=count
{
 "aggs" : {
   "colors" : {
       "terms" : {
           "field" : "color"
       }
    }
  }
}
and this is the java version I am trying to build but it returns empty buckets:
SearchResponse sr = client
        .prepareSearch("cars")
        .setTypes("transactions")
        .setSearchType(SearchType.COUNT)
        .addAggregation(AggregationBuilders.terms("colors").field("color"))
        .execute()
        .actionGet();
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.