I have my mapping as below
{
"state": "open",
"settings": {
"index": {
"creation_date": "1457004137507",
"analysis": {
"filter": {
"my_word_delimiter": {
"catenate_all": "true",
"split_on_numerics": "true",
"split_on_case_change": "true",
"type": "word_delimiter",
"preserve_original": "true"
}
},
"analyzer": {
"my_analyzer": {
"filter": [
"standard"
,
"lowercase"
,
"my_word_delimiter"
],
"type": "custom",
"tokenizer": "whitespace"
}
}
},
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "zAT_MukSSTyIVKXQz-7YKw",
"version": {
"created": "2020099"
}
}
},
"mappings": {
"Product": {
"properties": {
"ProductCode": {
"index": "not_analyzed",
"type": "string"
},
"id": {
"index": "no",
"store": true,
"type": "integer"
},
"Name": {
"store": true,
"type": "string"
},
"ShortDescription": {
"type": "string"
}
}
}
I have product with name "Brother TN-2000 Toner Black" and when I use following query with "tn 2000" or "tn-2000", I am getting it in the search result. but when I use "tn2000", it will not return me anything. I though that word_delimiter and catenate_all should give me expected inverted index. what am I doing wrong? can you please help me?
{"query":{"bool":{"should":[{"multi_match":{"type":"best_fields","query":"tn 2000","fields":["Name^7","ShortDescription^6"]}}]}}}
when I check the analyzer with the following curl query,
curl -XGET "localhost:9200/myIndex/_analyze?analyzer=my_analyzer&pretty
=true" -d 'Brother TN-2000 Toner Black'
it returns me
{
"tokens" : [ {
"token" : "'brother",
"start_offset" : 0,
"end_offset" : 8,
"type" : "word",
"position" : 0
}, {
"token" : "brother",
"start_offset" : 1,
"end_offset" : 8,
"type" : "word",
"position" : 0
} ]
}
curl: (6) Could not resolve host: TN-2000
curl: (6) Could not resolve host: Toner
curl: (6) Could not resolve host: Black'