Skip to content

< and > cannot be escaped in query strings #21703

@jpountz

Description

@jpountz

The query_string query has < and > operators that make it easy to build range queries. For instance, age:>18 is equivalent to age:{18 TO *]. The issue however is that given that it is implemented on top of the base Lucene query parser (< and > are handled in MapperQueryParser#getFieldQuerySingle), they cannot be escaped like other query operators. So if you want to search for a term that starts with < or > in a keyword field, the only way to do so is to quote the searched term, eg. my_field:">value".

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions