erichard / elasticsearch-query-builder

Build query for an ElasticSearch client using a fluent interface
MIT License
39 stars 20 forks source link

Add average aggregation #29

Open mahdi-masa opened 3 months ago

mahdi-masa commented 3 months ago

consider the following elastic query

`"aggs" => [
                "read_ratio_avg" => [
                    "avg" => [
                        "field" => "read-ratio",
                    ],
                ],
            ],
            "query" => [
                "bool" => [
                    "must" => [
                        [
                            "range" => [
                                "read-ratio" => [
                                    "gt" => 0,
                                ],
                            ],
                        ],
                        [
                            "match" => [
                                "url" => $hash,
                            ],
                        ],
                    ],
                ],
            ],`

your library handle every section of this query but there is no average aggregation in your library