elasticsearch 近義詞 遠程配置


以前寫的一遍文章,被刪除了,現在補回來。


首先安裝插件 dynamic-synonym,


curl -XPOST "http://localhost:9200/*/" -d '{
        "analysis": {
            "analyzer":{
                    "mysynonym":{
                        "type": "custom",
                        "tokenizer":"ik_max_word",
                        "filter":[
                            "remote_synonym"
                        ]
                    }
                },
                "filter":{
                    "remote_synonym":{
                        "expand": true,
                        "ignore_case": true,
                        "type": "dynamic_synonym",
                        "synonyms_path" :  "http://*/word/getAllSynonymToTokenStream",
                        "interval": 60
                    }
                }
        }
}';

上面的url, 返回一組列表,格式如下(逗號分隔)

西紅柿,番茄

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章