Thanks in Advance for Help,
I have created a elastic search _search query as below :
{
"size" : 0,
"aggs": {
"attrs_root": {
"nested": {
"path": "tags"
},
"aggs": {
"scope_term": {
"terms": {
"field": "tags.scope.keyword"
},
"aggs": {
"tag_term": {
"terms": {
"field": "tags.tag.keyword"
}
}
}
}
}
}
}
}
Now I want to convert this query in Java Elastic Search Transport Client 6.2 . I tried with below code but it is not returning same results. :
NestedAggregationBuilder nested = AggregationBuilders.nested("attrs_root", "tags");
NestedAggregationBuilder subAggregation = nested
.subAggregation(AggregationBuilders.terms("scope_term").field("tags.scope.keyword"));
subAggregation = subAggregation.subAggregation(AggregationBuilders.terms("tag_term").field("tags.tag.keyword"));
requestBuilder.addAggregation(nested);
response = requestBuilder.execute().actionGet();
Could you please let me know how i can get same results?
Thank Again !!!