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
}