0
votes

I am using Elastic search 6.2.3. We are using the query_string full-text-query for the full-text search. At present, if we search lazy brown fox it searches any file that has all these words lazy, brown and fox but it does not look for exact-phrase 'lazy brown fox', even default slop is zero.

Here is an example:

{
  "query": {
    "query_string": {
      "fields": [],
      "query": "lazy AND brown AND fox"
    }
  }
}  

I have looked at the match-phrase-query but the issue is that we have to specify the field name(s) in match-phrase-query whereas, in string-query, it's working with a blank array at fields option.

Please suggest, how to get the exact phrase match results using query_string full text-query?

1

1 Answers

1
votes

Instead of looking at match-phrase query to run phrase query on multiple fields take a look at multi_match which do supports phrase type query

POST phrase_index/_search
{
  "query": {
    "multi_match": {
      "query": "this is where it should work",
      "fields": [],
      "type": "phrase"
    }
  }
}