If a have an index with a trim normalizer and try and use a wildcard search with it, I am seeing behaviour that I would not expect to see
// create an index and populate it with a document
PUT /test-normalizer-index
{
"settings": {
"analysis": {
"normalizer": {
"trimming_normalizer": {
"filter": [
"trim"
]
}
}
}
},
"mappings": {
"properties": {
"name": {
"type": "keyword",
"normalizer": "trimming_normalizer"
}
}
}
}
POST /test-normalizer-index/_doc/
{
"name": "elastic search"
}
If I then send the following query I would expect it to match elasti? search
should match elastic search
however the following query returns 0 hits
GET /test-normalizer-index/_search
{
"query": {
"wildcard": {
"name": {
"value": "elasti? search"
}
}
}
}
-- returns --
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
These are the behaviours:
-
elast?c search
-> finds a document -
elastic searc?
-> finds a document -
?lastic search
-> finds a document -
elastic ?earch
-> fails to find a document -
elastic ??earch
-> finds a document -
elasti? search
-> fails to find a document -
elasti?? search
-> finds a document
Tests 4 to 7 are the opposite behaviours to what I would expect. Is this a problem with elasticsearch or is this expected behaviour?