Hi All,
I have a requirement to fetch data from Elasticsearch based on Term aggregation. I need to build a request using terms aggregation where I need to groupby a particular field name and then fetch other fields corresponding to that particular field value.
For example, I have the following fields:
Hostname, hostip, hostinglocation, applicationinfo, portsopened.
Now first I need to groupby using Hostname and then fetch the corresponding values of hostip, hostinglocation, applicationinfo and portsopened for that particular hostname.
Again for the next hostname, i need the next set of information.
so the request should something like below:
{
"aggs": {
"agg1": {
"terms": {
"field": "field1"
},
"aggs": {
"agg2": {
"terms": {
"field": "field2"
},
"aggs": {
"agg3": {
"terms": {
"field": "field3"
}
}
}
}
}
}
}
}