其他分享
首页 > 其他分享> > elasticsearch 近义词 远程配置

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, 返回一组列表,格式如下(逗号分隔)

西红柿,番茄

标签:近义词,synonym,word,dynamic,http,elasticsearch,remote,type,远程
来源: http://blog.51cto.com/12597095/2348559