How to increase the exact match of several matches in the elastic search

I am executing the following query to increase exact match on multi_match in search mode. But not getting the expected results.

My goal is to upgrade in the following order: "java developer"> java AND developer> java OR developer

Can anyone help with troubleshooting? You need to know how I can increase the value of match_phrase here and how to add the remaining fields to match_phrase

"query": { "bool": { "must": [ { "multi_match": { "query": "java developer", "fields": [ "title", "content", "tags", "summary" ] } } ], "should": [ { "match_phrase": { "title": "java developer" } }, { "multi_match": { "query": "java developer", "fields": [ "title", "content", "tags", "summary" ], "operator": "and", "boost": 4 } } ] } } 

Many thanks for your help.

+8
elasticsearch lucene
source share
2 answers

Here is what worked for me:

  "query": { "bool": { "must": [ { "multi_match": { "query": "java developer", "fields": [ "title", "content", "tags", "summary" ] } } ], "should": [ { "multi_match": { "query": "java developer", "fields": [ "title", "content", "tags", "summary" ], "type": "phrase", "boost": 10 } }, { "multi_match": { "query": "java developer", "fields": [ "title", "content", "tags", "summary" ], "operator": "and", "boost": 4 } } ] } } 
+7
source share

Set the request type for multiple most_fields matches:

 "query": { { "multi_match" : { "query": "java developer", "type": "best_fields", "fields": ["title", "content", "tags", "summary" ] } } } 
+1
source share

All Articles