I'm using ES 1.0.0. I'm storing products with a "color" string field which
is just a single string representing a color (e.g. "white" or "purple"). I
want queries for variations of these color names to return results, so I've
defined the following analyzer and set it to be used as the search_analyzer
for the color field:
Settings
{
"analysis": {
"analyzer": {
"color_synonyms" : {
"tokenizer" : "whitespace",
"filter" : ["synonyms"]
}
},
"filter" : {
"synonyms" : {
"type" : "synonym",
"synonyms_path" : "analysis/synonyms.txt",
"ignore_case" : true
}
}
}
}
Mapping:
"color" : {
"type" : "string",
"index_analyzer" : "keyword",
"search_analyzer" : "color_synonyms"
},
I've tested that the analyzer works correctly:
curl -XGET 'localhost:9200/products/_analyze?analyzer=color_synonyms' -d
'purple'
{"tokens":[{"token":"lila","start_offset":0,"end_offset":6,"type":"SYNONYM"
,"position":1},{"token":"purpur","start_offset":0,"end_offset":6,"type":
"SYNONYM","position":1},{"token":"purple","start_offset":0,"end_offset":6,
"type":"SYNONYM","position":1}]}
But it seems it doesn't use the analyzer for the color field:
curl -XGET 'localhost:9200/products/_analyze?field=Product.color' -d
'purple'
{"tokens":[{"token":"purple","start_offset":0,"end_offset":6,"type":"word"
,"position":1}]}
Am I missing something obvious or doing something wrong?
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fa5b8282-019b-434a-94b4-3a60eec7d893%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.