How to implement synonyms


(amadman114) #1

Hi, I'm trying to implement a synonym filter with my edge_ngram filter.
This is my code to create the database:

Create icecat with a single primary shard

and set up the autocomplete analyzer using

edge ngrams

PUT /icecat
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 15
},
"synonym_filter" : {
"type" : "synonym",
"synonyms" :
["hard drive, hard disk drive, SSD => HDD",
"VDU, screen, LCD, TFT, CRT => Monitor",
"power supply, power adapter, ac adapter, power cord, charger => adapter",
"mice => mouse",
"wire less => wireless",
"pick up => pickup",
"PSU => power supply unit",
"converter => adapter",
"ATX, mobo => motherboard",
"notebook, chromebook, netbook, lap top => laptop",
"CPU, chip, core => processor",
"DDR3, DDR2, DDR => memory",
"gfx, video => graphics",
"laser, engine => fuser",
"mousepad, mouse pad => touchpad",
"small form factor => SFF",
"ginger => foxes"]
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter",
"synonym_filter"
]
}
}
}
}
}

However, after indexing some documents on which the synonyms should work, it doesn't, but it does use the autocomplete filter


(system) #2