How can wildcard be used in a phrase query?


What are the possible options for a phrase query to include wildcards using query_string ?
Without the wildcard below query returns some result. However, adding wildcard in any part of the query will no longer work.

I have seen similar questions on this but no working solution.

              "query":"message:\"My Resume*\"",

I was expecting following results to match for above query.
My Resume 2017
My Resume 2013
My Resume

What are my other options?

(David Pilato) #2

Without using any wildcard the phrase query will match the 3 documents by default. Why do you want to ask your user to add a wildcard ?


Thanks, David.

Ok, my example and query need to be updated. I have following data indexed in elasticsearch.

  1. My Resume 2017
  2. My Resume 2013
  3. My Resume
  4. My Old Resume
  5. My Reservation
  6. My Resolution
  7. My New Year Resolution
  8. My __Resume with lot of spaces

The problem is the space. If user search for "My Res*", it is expected to match 1,2,3,5,6. Because of the space in between, phrase query seems to be the ideal choice but it seems that * is not interpreted as a wildcard. What are my options?

(system) #4

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