I am trying to determine how to configure elasticsearch so that I can search for a query string using wildcards in fields containing hyphens.
I have documents that look like this:
{ "tags":[ "deck-clothing-blue", "crew-clothing", "medium" ], "name":"Crew t-shirt navy large", "description":"This is a t-shirt", "images":[ { "id":"ba4a024c96aa6846f289486dfd0223b1", "type":"Image" }, { "id":"ba4a024c96aa6846f289486dfd022503", "type":"Image" } ], "type":"InventoryType", "header":{ } }
I tried using the word_delimiter filter and the space tokenizer:
{ "settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 1 }, "analysis" : { "filter" : { "tags_filter" : { "type" : "word_delimiter", "type_table": ["- => ALPHA"] } }, "analyzer" : { "tags_analyzer" : { "type" : "custom", "tokenizer" : "whitespace", "filter" : ["tags_filter"] } } } }, "mappings" : { "yacht1" : { "properties" : { "tags" : { "type" : "string", "analyzer" : "tags_analyzer" } } } } }
But these are searches (for tags) and their results:
deck* -> match deck-* -> no match deck-clo* -> no match
Can anyone see where I'm wrong?
Thanks:)
source share