Wildcard queries should not normalize wildcards from queries
Example scenario where wildcard queries do not exhibit expected behavior:
PUT my-index
{
"mappings": {
"_doc": {
"properties": {
"foo": {
"type": "keyword",
"normalizer": "no_wildcard"
}
}
}
},
"settings": {
"index": {
"analysis": {
"char_filter": {
"no_wildcard": {
"pattern": "[\\*]",
"type": "pattern_replace",
"replacement": ""
}
},
"normalizer": {
"no_wildcard": {
"type": "custom",
"char_filter": "no_wildcard"
}
}
}
}
}
}
PUT /my-index/_doc/1
{
"foo": "bar"
}
GET my-index/_search
{
"profile": true,
"query": {
"wildcard": {
"foo": {
"value": "ba*"
}
}
}
}
The resulting input that is provided to the wildcard query removes the *.
// output from the query profiler for above query
...
{
"type" : "MultiTermQueryConstantScoreWrapper",
"description" : "foo:ba",
...
Because of this, the search does not find any matching documents.
I believe this relates to #28894.
Wildcard queries should not normalize wildcards from queries
Example scenario where wildcard queries do not exhibit expected behavior:
The resulting input that is provided to the wildcard query removes the
*.Because of this, the search does not find any matching documents.
I believe this relates to #28894.