On a performance testing project where ELK stack is used to collect and process API test data streams(samples/document go under one index) it would be good if we could get multiple aggregated results with only one _search request, like the count of successful requests AND average response time AND various percentiles, etc. Is it possible to create such a DSL query or do we have to execute multiple searches like one to get the count of successful requests, another one for percentiles, etc?
CodePudding user response:
you sure can, this page of the documentation gives an example, but here it is for reference;
curl -X GET "localhost:9200/my-index-000001/_search?pretty" -H 'Content-Type: application/json' -d'
{
"aggs": {
"my-first-agg-name": {
"terms": {
"field": "my-field"
}
},
"my-second-agg-name": {
"avg": {
"field": "my-other-field"
}
}
}
}
'