Elastic Search Using Wildcard in Exact Search query_string

Having a problem trying to get a wildcard and find the exact search phrase using query_string.

Want the results to come back, which is the exact phrase of all options. ie Coors Brewing, Coors Brewery, Coors Brews, etc.

POST _search
{
"query": {
  "query_string": {
    "default_operator": "AND", 
    "analyze_wildcard": true,
    "query": "\"coors brew*\""
  }
}
}

      

I'm not married to this approach, but would like to search most of the document to find matches against 1 or 2 fields.

+3


source to share


1 answer


This seems to be the perfect query option match_phrase_prefix

( documentation ): have you tried it?

If you need to make your query on multiple fields at the same time, look at queries multi_match

with type phrase_prefix

( documentation ).



The difference from your query_string

wilcard based query is that the match queries are not parsed and although they do not support the query_string syntax .

+1


source







All Articles