Say I have a document representing a tagged resource.
{
"name": "Foo",
"tags": [1, 2, 3]
},
{
"name": "Bar",
"tags": [3, 4, 5]
}
Now let's say that I run this query:
{
"query": {
"terms": {
"tags": [3, 5]
}
}
}
I want to know that it returns Foo because it is tagged with 3 and Bar, because it is labeled 3 and 5. I know this seems obvious, but I'm building a very complex query full of filters, and itβs important so that I display the correct selection so that the user understands why these specific results are returned. This is easily solved by highlighting the fields in which I am performing a full-text search, but this has been complicated by queries termssuch as this.
- ? , :
{
"name": "Foo",
"tags": "1 2 3"
},
{
"name": "Bar",
"tags": "3 4 5"
}
, :
{
"query": {
"match": {
"tags": "3 5"
}
},
"highlight": {
"fields": {
"tags": {}
}
}
}
, . ?