Give a query like the one below, how can I get the max relevance score from each bucket?
GET /omni_filters/_search/
{
"aggs" : {
"uniqueHits" : {
"terms" : {
"field" : "command"
}
}
},
"query" : {
"bool": {
"must": [
{
"match": {
"request": "requests ? opened"
}
}
],
"should" : [{
"term" : {
"request" : "customer"
}
}]
}
}
}
The goal is to create a search bar that can take an input like this: "All the requests I opened yesterday" and return a list of relevant elasticsearch queries. I do this by indexing a large number of requests and their corresponding elasticsearch commands, or similar DSL that can be translated to elasticsearch. The only problem is that I may have many more ways to say one command than to say another, so I need to group the results by the command term, and then get the most relevant score from each bucket.
Is that possible?