三天打鱼,两天晒网

仰望星空,脚踏实地

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

官网: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是需要分词的字段。

 

posted on 2019-06-03 13:56  三天打鱼,两天晒网  阅读(517)  评论(0编辑  收藏  举报