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
        }
      ]
    }
  • 相关阅读:
    js中this的用法
    js原型链与继承(初体验)
    关于C语言指针中的p++与p+i
    react todolist
    react表单提交
    react条件渲染
    react初体验
    初次接触express
    阿里内推在线编程题(返回元素的选择器)
    模块初始化
  • 原文地址:https://www.cnblogs.com/wscsq789/p/12275894.html
Copyright © 2011-2022 走看看