We have index mapping like this:
{
"mappings": {
"_source": {
"includes": [
"uid"
]
},
"properties": {
"follow": {
"doc_values": true,
"eager_global_ordinals": true,
"index_options": "docs",
"type": "keyword"
},
"staticRank": {
"index": false,
"type": "long"
},
"id": {
"doc_values": false,
"norms": false,
"type": "keyword"
}
}
},
"settings": {
"index": {
"knn": false,
"merge": {
"policy": {
"segments_per_tier": 2
}
},
"number_of_replicas": 0,
"number_of_shards": "3",
"refresh_interval": "-1",
"sort": {
"field": "staticRank",
"order": "desc"
},
"store": {
"type": "mmapfs"
}
}
}
}
where "follow" is users which the candidate 'id' is connected to. When we make a search query, we do match on the "follow" terms and that way we retrieve candidates which are 2-levels away from the searcher.
Our query is like this:
{
"query": {
"terms": {
"follow": [ "id5", "id99", "id9" ],
}
}
}
This gives me any candidates where scores are all 1.
How can i run a query so that i get results where the scores are sorted in descending order and score signifies the overlap b/w searcher's "follow" and candidate's "follow" fields?