Allow wildcards in proximity searches with multiple words

Viewed 1358

I am using ElasticSearch 5.6 on Ubuntu 16.04. My problem is when i try to use wildcards inside a proximity search with multiple words.

Examples:

"hell* worl*"~3

Basically, I would like to get all the words that starts with "hell" and "worl" that are close to each other with a max distance of 3.

I do not get any error but it does not find the documents. It seems that wildcards are not analyzed. I also have set analyze_wildcard: true

The DOC says:

By default, wildcards terms in a query string are not analyzed. By setting this value to true, a best effort will be made to analyze those as well.

But, only the following query works:

"hello world"~3 # this works

This is my query:

{  
   "size":15,
   "from":0,
   "query":{  
      "bool":{  
         "must":[  
            {  
               "query_string":{  
                  "query":"\"hell* worl*\"~3",
                  "analyze_wildcard":true
               }
            }
         ]
      }
   }
}

Reference:

1 Answers
Related