• 1.8 Elasticsearch建立IK中文分词器


    IK中文分词器

    Github:https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v8.2.3

    • zip解压:unzip  elasticsearch-analysis-ik-8.2.3.zip

     unzip elasticsearch-analysis-ik-8.2.3.zip -d /usr/local/elasticsearch-8.2.3/plugins/ik 

     重启ES

     如果启动报错:

     解决办法

    cd /usr/local/elasticsearch-8.4.0/plugins/ik

    vim plugin-descriptor.properties

    修改 plugin-descriptor.properties 文件中 elasticsearch.version=你的ES版本号

    我之前安装的是ES8.4.0但是用上面的方法虽然会解决报错,但是会出现其他的报错。

    所以我将ES降到了ES8.2.3版本。和analysis-ik的分词器版本一致。

    测试中文分词效果

    POST /_analyze
    {
        "analyzer": "ik_max_word",
        "text": "上下班车流量很大"
    }

    演示:

    结果:

     {
        "tokens": [{
                "token": "上下班",
                "start_offset": 0,
                "end_offset": 3,
                "type": "CN_WORD",
                "position": 0
            },
            {
                "token": "上下",
                "start_offset": 0,
                "end_offset": 2,
                "type": "CN_WORD",
                "position": 1
            },
            {
                "token": "下班",
                "start_offset": 1,
                "end_offset": 3,
                "type": "CN_WORD",
                "position": 2
            },
            {
                "token": "班车",
                "start_offset": 2,
                "end_offset": 4,
                "type": "CN_WORD",
                "position": 3
            },
            {
                "token": "车流量",
                "start_offset": 3,
                "end_offset": 6,
                "type": "CN_WORD",
                "position": 4
            },
            {
                "token": "车流",
                "start_offset": 3,
                "end_offset": 5,
                "type": "CN_WORD",
                "position": 5
            },
            {
                "token": "流量",
                "start_offset": 4,
                "end_offset": 6,
                "type": "CN_WORD",
                "position": 6
            },
            {
                "token": "很大",
                "start_offset": 6,
                "end_offset": 8,
                "type": "CN_WORD",
                "position": 7
            }
        ]
    }

  • 相关阅读:
    C++ 虚析构
    SpringCloud案例day04.md
    Redis(10)Geospatial 地理位置
    1.2 HTML5
    【课程作业】西瓜书 机器学习课后习题 : 第二章
    集简云&银行系统:API连接广告推广与客服系统,降低企业研发成本
    Python实现视频自动打码,不用担心透露隐私了
    云计算正当时!将你的Java项目容器化
    强力删除在C盘中流氓软件文件的方法
    虹科动态 | cippe2022即将举办,报名火热进行中
  • 原文地址:https://blog.csdn.net/Xx13624558575/article/details/126640210