How can we use exists query in tandem with the search query in Elasticsearch

(ashit pupu) #1

I have a scenario in Elasticsearch where my indexed docs are like this :-

{"id":1,"name":"xyz", "address": "xyz123"}
{"id":1,"name":"xyz", "address": "xyz123"}
{"id":1,"name":"xyz", "address": "xyz123", "note": "imp"}

Here the requirement stress that we have to do a term match query and then provide relevance score to them which is a straight forward thing but the additional aspect here is if any doc found in search result has note field then it should be given higher relevance. How can we achieve it with DSL query? Using exists we can check which docs contain notes but how to integrate with match query in ES query. Have tried lot of ways but none worked. Any help will be appreciated.


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.