I'm new to elasticsearch, so be kind.
I'm trying to store and query data, which is tagged with N number of tags. I want to compare a search query array with the stored array and return the results in order of which items match the most tags.
Dataset example:
{ name: "karl", tags: ["terrible", "programmer"] }
{ name: "bob", tags: ["awesome", "programmer"] }
Query example, matching both people:
query: { tags: ["programmer"] }
result: [karl, bob]
And in this example, both are returned but bob scores high, because more tags were matched, Karl is still shown though, despite not matching on awesome.
query: { tags: ["programmer", "awesome"] }
result: [bob, karl]
The closet I have got is this, however it doesn't seem to score bob higher than karl
{
"query": {
"bool": {
"should": [
{ "match": { "tags": "programmer" } },
{ "match": { "tags": "awesome" } }
],
"minimum_number_should_match": 1
}
}
}
Would love some support :-) Thanks!

