Skip to content

Expose splitOnWhitespace in Query String Query #20841

@jimczi

Description

@jimczi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>enhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions