Using the wildcard operator, I can match terms starting with some value:
{
"query": {
"query_string" : {
"query" : "subject:cell*"
}
}
}
The subject
field here is a keyword
field (non-analyzed). This works fine, but I cannot figure out how to find terms starting with, say, "cellular contr". Trying double quotes did not yield the expected results:
{
"query": {
"query_string" : {
"query" : "subject:\"cellular contr*\""
}
}
}
Note: phrase search works fine with exact matches, just not with the wildcard. My guess is that the star is not interpreted as a wildcard operator inside the double quotes. Is that correct? And is there any other way to use the wildcard operator with a phrase?
Note: I have to use Query String Query, since the query is coming from user input.
(I know I could resort to regexp, but would prefer not to)