es近义词(同义词)配置

分析器配置:

{
    "settings": {
        "number_of_shards": 5,
        "number_of_replicas": 1,
        "analysis": {
            "analyzer": {
                "ik_synonym": {
                    "type": "custom",
                    "tokenizer": "ik_max_word",
                    "filter": [
                        "my_synonym_filter"
                    ]
                }
            },
            "filter": {
                "my_synonym_filter": {
                    "type": "synonym",
                    "synonyms_path": "analysis/synonym.txt"
                }
            }
        }
    }
}

在es的config目录创建 analysis/synonym.txt 文件即可

cd /usr/local/elasticsearch-5.2.2/config
mkdir analysis && touch analysis/synonym.txt

你可能感兴趣的:(es近义词(同义词)配置)