Sort aggregation by score


(Elton Martins) #1

I need to aggregation items of a text field and sort by score

{
    "aggs": {
        "name": {
            "aggs": {
                "name": {
                    "terms": {
                        "field": "name.raw",
                        "size": 5
                    }
                }
            },
            "bool": {
                "must": [
                    {
                        "match": {
                            "name.auto": "New York"
                        }
                    }
                ],
                "should": [
                    {
                        "match_phrase_prefix": {
                            "name.lower": "New York"
                        }
                    }
                ]
            }
        }
    },
    "size": 0
}

(system) #2

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