-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Relevance/AnalysisHow text is split into tokensHow text is split into tokens>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Description
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.
Metadata
Metadata
Assignees
Labels
:Search Relevance/AnalysisHow text is split into tokensHow text is split into tokens>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch