Since Lucene 6.2.0 it is possible to disable the parse on whitespace behavior of the query parser,
instead, preferably the queryparser would parse around only real 'operators'.
We should expose this option in the query_string_query:
{
"query_string" : {
"fields" : ["title", "text"],
"query" : "foo bar",
"split_on_whitespace": false
}
}
this would solve many cases where splitting on whitespace is problematic (ngram, shingles, multi word synonyms).
The match query is usually a good alternative for these cases except for users that relies on some features of the query_string_query not present in the match query (boolean operators, explicit prefix word or phrase, ...).
Note that this is already possible to disable the splitting on whitespace in the simple query string query. The flags option can be used to disable the whitespace in the grammar though it is not documented.
Since Lucene 6.2.0 it is possible to disable the parse on whitespace behavior of the query parser,
We should expose this option in the
query_string_query:this would solve many cases where splitting on whitespace is problematic (ngram, shingles, multi word synonyms).
The
match queryis usually a good alternative for these cases except for users that relies on some features of thequery_string_querynot present in thematch query(boolean operators, explicit prefix word or phrase, ...).Note that this is already possible to disable the splitting on whitespace in the
simple query string query. Theflagsoption can be used to disable the whitespace in the grammar though it is not documented.