Can I add a sub "term" "aggregation" for a x-axis filters aggregation?

Hello, experts. I am trying to customize an aggregation via "Json Input" for a horizontal bar chart, and the data I am using is the flight demo data. The purpose is that I want to specify aggregations for every filter on x-axis.

I inputed the script like:

{
    "aggs": {
                        "3": {
                            "terms": {
                                "field": "DestCityName",
                                "order": {
                                    "_count": "desc"
                                },
                                "size": 5
                            }
                        }
                    }
    
}

But the system indicates me "search error". Is there any suggestion?

Hello,

"Split sereis" is not enough for you?
Is there any reason to use Json input for sub-aggregation?

Thank you for your reply. I found that the sub aggregation applied to all filters. I want to use sub-aggregation for specific filter.

I suppose it's difficult. Why not making multiple charts?

Hi Tomo. Multiple charts is difficult for my use case to be understand by user. I am thinking the solution about Vega. Do you have some advice?

Vega-lite has high flexibility worth trying.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.