elasticsearch中文分词使用过程总结

官网:https://github.com/medcl/elasticsearch-analysis-ik

过程总结:

1、先将ik下载,并解压到elasticsearch插件目录下。下载版本和elasticsearch一致。

2、重启elasticsearch

3、可以使用postman,创建索引并设置分词方式。

{
    "settings":{
        "analysis":{
            "analyzer":{
                "ik":{
                    "tokenizer":"ik_max_word"
                }
            }
        }
    },
    "mappings":{
        "content":{
            "_all":{
                "enabled":false
            },
            "properties":{
                "title":{
                    "type":"text",
                    "analyzer":"ik_max_word",
                    "search_analyzer":"ik_max_word"
                },
                "content":{
                    "type":"text",
                    "analyzer":"ik_max_word",
                    "search_analyzer":"ik_max_word"
                }
            }
        }
    }
}

上面的 title 、content是需要分词的字段。

原文地址:https://www.cnblogs.com/yanketao/p/10967181.html