zoukankan      html  css  js  c++  java
  • elasticsearch7.1安装analysis-ik中文分词插件

    首先确保机器应安装好elasticsearch服务,参考centos7安装运行Elasticsearch7.1

    插件版本和es版本要保持一致,直接运行以下命令完成安装,重启es即可。

    [root@guangzhou elasticsearch]$ su elk && pwd
    /usr/local/elasticsearch
    [elk@guangzhou elasticsearch]$ ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
    #安装成功查看下plugins目录,可见新增的文件analysis-ik
    [elk@guangzhou elasticsearch]$ ll plugins/
    总用量 4
    drwxr-xr-x 2 elk elk 4096 2月 8 14:37 analysis-ik
    [elk@guangzhou elasticsearch]$ ll config/
    总用量 44
    drwxr-x--- 2 elk elk 4096 2月 8 14:37 analysis-ik
    -rw-rw---- 1 elk elk 199 2月 7 16:08 elasticsearch.keystore
    -rw-rw---- 1 elk elk 2855 2月 8 16:16 elasticsearch.yml
    -rw-rw---- 1 elk elk 3544 2月 8 16:11 jvm.options
    -rw-rw---- 1 elk elk 17170 5月 23 2019 log4j2.properties
    -rw-rw---- 1 elk elk 473 5月 23 2019 role_mapping.yml
    -rw-rw---- 1 elk elk 197 5月 23 2019 roles.yml
    -rw-rw---- 1 elk elk 0 5月 23 2019 users
    -rw-rw---- 1 elk elk 0 5月 23 2019 users_roles
    
    #开两个窗口,一个启动elasticsearch,另一个输入以下命令,可以看到分词后的效果
    [elk@guangzhou elasticsearch]$ curl -H 'Content-Type: application/json'  -XGET 'localhost:9200/_analyze?pretty' -d '{"text":"热烈 庆祝沪昆高速开通"}'
    {
      "tokens" : [
        {
          "token" : "",
          "start_offset" : 0,
          "end_offset" : 1,
          "type" : "<IDEOGRAPHIC>",
          "position" : 0
        },
        {
          "token" : "",
          "start_offset" : 1,
          "end_offset" : 2,
          "type" : "<IDEOGRAPHIC>",
          "position" : 1
        },
        {
          "token" : "",
          "start_offset" : 2,
          "end_offset" : 3,
          "type" : "<IDEOGRAPHIC>",
          "position" : 2
        },
        {
          "token" : "",
          "start_offset" : 3,
          "end_offset" : 4,
          "type" : "<IDEOGRAPHIC>",
          "position" : 3
        },
        {
          "token" : "",
          "start_offset" : 4,
          "end_offset" : 5,
          "type" : "<IDEOGRAPHIC>",
          "position" : 4
        },
        {
          "token" : "",
          "start_offset" : 5,
          "end_offset" : 6,
          "type" : "<IDEOGRAPHIC>",
          "position" : 5
        },
        {
          "token" : "",
          "start_offset" : 6,
          "end_offset" : 7,
          "type" : "<IDEOGRAPHIC>",
          "position" : 6
        },
        {
          "token" : "",
          "start_offset" : 7,
          "end_offset" : 8,
          "type" : "<IDEOGRAPHIC>",
          "position" : 7
        },
        {
          "token" : "",
          "start_offset" : 8,
          "end_offset" : 9,
          "type" : "<IDEOGRAPHIC>",
          "position" : 8
        },
        {
          "token" : "",
          "start_offset" : 9,
          "end_offset" : 10,
          "type" : "<IDEOGRAPHIC>",
          "position" : 9
        }
      ]
    }
  • 相关阅读:
    IIS6.0服务器架站无法访问解决方案总结
    DNN中做支持多语言的模块
    在dotnetnuke中创建 parent portal
    DNN,Rainbow资源
    2005年岁末,各种主流CMS系统的比较和汇总
    在DNN中获取所有模块信息
    学习dnn的新资源,sooooooooo great!!
    DNN的电子商务模块
    DNN学习笔记
    也学ASP.NET 2.0 AJAX 之二:使用Timer控件
  • 原文地址:https://www.cnblogs.com/wscsq789/p/12275894.html
Copyright © 2011-2022 走看看