Using Aggregation by range time and terms


(Tenaz3) #1

Hi, I quite new on this concept of aggregations so still with basic problems to understand
I wanna 7 results of top events for the next 2 months. So I have two attributes to look. The max of people attending(attendings) is the definition of Top, but also I wanna order this by time(start_time: asc)
What I start to wrote but is wrong:

{
        "aggs": {
            "aggs": {
                "event_interval": {
                    "date_histogram": {
                        "field": "start_time",
                        "interval": "2M",
                        "format": "dateOptionalTime"
                    }
                },
                "max_attending": { "max": { "field": "attending" } },
                "_source": {
                    "include": [
                        "name"
                    ]
                }
            }
        }
    }

(system) #2