I bumped into a situation that when I send a query through http rest, I get result, but when equivalent aggregation send from java api, I can get result back.
I use Elasticsearch v1.7.2
here is my query send to http REST
{
"from" : 0,
"size" : 0,
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"match_all" : {}
}
}
},
"aggregations" : {
"byCategory" : {
"nested" : {
"path" : "categoryStatus"
},
"aggregations" : {
"sumByProductCount" : {
"sum" : {
"field" : "categoryStatus.productCount"
}
}
}
}
}
}
here is equivalent aggregation use java api
AbstractAggregationBuilder agg =
AggregationBuilders.nested("byCategory").path("categoryStatus").subAggregation(
sum("sumByProductCount").field("categoryStatus.productCount")
);
Any idea?