When searching using a wildcard words, i have an unexpected behavior.
I'm working on ES 5.6.8.
To reproduce the issue:
(Test with Kibana)
- create the index :
PUT my-index-00001
{
"mappings": {
"test": {
"properties": {
"name1": {
"type": "keyword",
"fields": {
"analyzed": {
"type" : "text",
"analyzer": "french_analyzer"
}
}
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"path_analyzer": {
"tokenizer": "path_tokenizer"
},
"french_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "asciifolding"]
}
},
"tokenizer": {
"path_tokenizer": {
"type": "path_hierarchy",
"delimiter": "/"
}
},
"normalizer": {
"lowercase_normalizer": {
"type": "custom",
"char_filter": [],
"filter": ["lowercase"]
}
}
}
}
}
- Insert test data:
POST my-index-00001/test
{
"name1" : "WT1"
}
POST my-index-00001/test
{
"name1" : "testWT1"
}
POST my-index-00001/test
{
"name1" : "WT1test"
}
- Make the search:
GET my-index-00001/test/_search
{
"query": {
"query_string": {
"query": "WT\\:*",
"fields": ["name1.analyzed"],
"default_operator": "AND",
"analyze_wildcard": true
}
}
}
As expected, this search returns both results ["name1": "WT:1test", "name1": "WT:1"]
but the issue is with a prefix wildcard as follow:
GET my-index-00001/test/_search
{
"query": {
"query_string": {
"query": "*WT\\:",
"fields": ["name1.analyzed"],
"default_operator": "AND",
"analyze_wildcard": true
}
}
}
same issue with query "WT\:".
this search does not return any result.
Expected result: documents with ["name1": "WT:1test", "name1": "WT:1", "name1": "testWT:1"]