Hi,
I've run into an issue with using Composite Aggregations and Pipeline Aggregations.
Currently, I create buckets according to my sources using the Composite Bucket Aggregation, but I am only using one source field (one term). I would like to sort these buckets in ascending order by that term using the bucket_sort Pipeline Aggregation.
The following is the bucket_sort section of my query...
"fc_buckets_sort": { "bucket_sort": { "sort": [{"_key": {"order": "asc"}}]}}
Running this yields the following error...
{
"error": {
"root_cause": [],
"type": "search_phase_execution_exception",
"reason": "",
"phase": "fetch",
"grouped": true,
"failed_shards": [],
"caused_by": {
"type": "class_cast_exception",
"reason": "org.elasticsearch.search.aggregations.bucket.composite.InternalComposite$ArrayMap cannot be cast to java.lang.Comparable"
}
},
"status": 503
}
I switched from Composite Aggregation to a Terms Aggregation to confirm my Pipeline Aggregation syntax was correct - with Terms Aggregation the operation is completed successfully.
"_count" (instead of "_key") does work though
I'm thinking that the issue arises because the Composite query can use multiple terms/parameters, and if there is more than 1 parameter to build the buckets off of then the key for the returned buckets is comprised of multiple values... like the following:
{
"key": {
"wr": "CHA1",
"gl": "147"
},
"doc_count": 2,
...
I'm assuming I need to add some additional information to my bucket path (and not just "_key"in order to point it to the right subKey). But, I haven't had any luck getting the right syntax down - and advice?
Thank you