elasticsearch-analysis-synonym icon indicating copy to clipboard operation
elasticsearch-analysis-synonym copied to clipboard

Plugin is working only for synonym refresh, but not for ngramm

Open Bklara opened this issue 8 years ago • 2 comments

i create index: PUT { "syn_plugin": { "aliases": {}, "mappings": { "item": { "properties": { "id": { "type": "keyword" }, "msg": { "type": "text", "analyzer": "2gram_synonym_analyzer" } } } }, "settings": { "index": { "number_of_shards": "1", "provided_name": "syn_plugin", "creation_date": "1499842592678", "analysis": { "analyzer": { "2gram_synonym_analyzer": { "type": "custom", "tokenizer": "2gram_synonym" } }, "tokenizer": { "2gram_synonym": { "type": "ngram_synonym", "synonyms_path": "synonym_for_plugin.txt", "n": "2" } } }, "number_of_replicas": "0", "uuid": "LV8nkTxaRqGw0HhP-inhvw", "version": { "created": "5020299" } } } } }

put doc:

POST syn_plugin/item/3
{
	"id":"2",
	"msg":"asics"
}

asking: GET syn_plugin/item/_search?q="as" or GET syn_plugin/item/_search?q="a" and got nothing only when : GET syn_plugin/item/_search?q="asics" i got a doc

what is wrong?

Bklara avatar Jul 16 '17 15:07 Bklara

It depends on synonym_for_plugin.txt.

GET syn_plugin/item/_search?q="a"

Your setting is bi-gram.

GET syn_plugin/item/_search?q="as"

If you put asics to synonym_for_plugin.txt, the token is asics, not ["as", "si",...]. If asics is not in the dictionary file, it'll hit as.

marevol avatar Jul 16 '17 21:07 marevol

Oh ,thanks! Stupid error) i will check this. But another question is: hoe i can change your plugin to use EdgeNgram? This is very important. Only your plugin for dynamic refresh synonyms available now for 5x versions.

And what if i choose n=0, i want only update synonyms on one field

Bklara avatar Jul 20 '17 14:07 Bklara