I am trying to create a bucket script based off of 2 single metric buckets and am having no luck.
My initial bucket query works:
{
"query": {
"bool": {
"must": [
{ "match": { "call_ty": "10"} },
{ "match": { "otg.keyword": "agg-0002363334"} }
]
}
},
"size": 0,
"aggs": {
"Attempts": {
"value_count": { "field": "dur"}
},
"Completed":{
"filter": {
"range": {
"dur": {
"from" : 1
}
}
}
}
}
}`Preformatted text`
Returning:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 190,
"max_score": 0,
"hits": []
},
"aggregations": {
"Attempts": {
"value": 190
},
"Completed": {
"doc_count": 23
}
}
}
When I try to add the bucket script I get an error:
{
"query": {
"bool": {
"must": [
{ "match": { "call_ty": "10"} },
{ "match": { "otg.keyword": "agg-0002363334"} }
]
}
},
"size": 0,
"aggs": {
"attempts": {
"value_count": { "field": "dur"}
},
"completed":{
"filter": {
"range": {
"dur": {
"from" : 1
}
}
}
},
"ASR": {
"bucket_script": {
"buckets_path": {
"att": "attempts",
"com": "completed>_count"
},
"script": "com / att*100"
}
}
}
}
Error:
{
"error": {
"root_cause": [
{
"type": "aggregation_execution_exception",
"reason": "Invalid pipeline aggregation named [ASR] of type [bucket_script]. Only sibling pipeline aggregations are allowed at the top level"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "cdrs2",
"node": "7407ULsCQkWlIrFxhis8tg",
"reason": {
"type": "aggregation_execution_exception",
"reason": "Invalid pipeline aggregation named [ASR] of type [bucket_script]. Only sibling pipeline aggregations are allowed at the top level"
}
}
]
},
"status": 500
}
Any assistance with this would be greatly appreciated. Thanks!