In Elastic, I am trying to do average aggregation on bool query filter. But I am getting unable to parse BaseAggregationBuilder with name [query]: parser not found.
My Objective :
- Filter the processName : AddCustomer and messageType : Response documents.
- Find average response time for the filtered data using the field elapsed_time
My code
{
"from": 0,
"size": 20,
"aggs": {
"filtered_elapsed_time": {
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"match": {
"processName": "AddCustomer"
}
},
{
"match": {
"messageType": "Response"
}
}
]
}
}
]
}
},
"aggs": {
"avg_et": {
"avg": {
"field": "elapsed_time"
}
}
}
}
}
}
Error Response
{
"error": {
"root_cause": [
{
"type": "named_object_not_found_exception",
"reason": "[6:18] unable to parse BaseAggregationBuilder with name [query]: parser not found"
}
],
"type": "named_object_not_found_exception",
"reason": "[6:18] unable to parse BaseAggregationBuilder with name [query]: parser not found"
},
"status": 400
}