首页 > Windows开发 > 详细

ES-windos环搭建-ik中文分词器

时间:2019-04-21 20:40:16      阅读:172      评论:0      收藏:0      [点我收藏+]

ik下载

  • 打开Github官网,搜索elasticsearch-analysis-ik,单击medcl/elasticsearch-analysis-ik。或者直接点击

技术分享图片

  • readme.md文件中,下拉选择预编译版本。

技术分享图片

  • 由于ikelasticsearch存在兼容问题。所以在下载ik时要选择和elasticsearch版本一致的,也就是选择v6.5.4版本,单击elasticsearch-analysis-ik-6.5.4.zip包,自动进入下载到本地。

技术分享图片

  • 本地下载成功后,是个zip包。

技术分享图片

安装

  • 首先打开C:\Program Files\elasticseach-6.5.4\plugins目录,新建一个名为ik的子目录,并将elasticsearch-analysis-ik-6.5.4.zip包解压到该ik目录内也就是C:\Program Files\elasticseach-6.5.4\plugins\ik目录。

技术分享图片

测试

  • 首先将elascticsearchkibana服务重启。
  • 然后地址栏输入http://localhost:5601,在Dev Tools中的Console界面的左侧输入命令,再点击绿色的执行按钮执行。
GET _analyze
{
  "analyzer": "ik_max_word",
  "text": "上海自来水来自海上"
}

右侧就显示出结果了如下所示:

{
  "tokens" : [
    {
      "token" : "上海",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "CN_WORD",
      "position" : 0
    },
    {
      "token" : "自来水",
      "start_offset" : 2,
      "end_offset" : 5,
      "type" : "CN_WORD",
      "position" : 1
    },
    {
      "token" : "自来",
      "start_offset" : 2,
      "end_offset" : 4,
      "type" : "CN_WORD",
      "position" : 2
    },
    {
      "token" : "水",
      "start_offset" : 4,
      "end_offset" : 5,
      "type" : "CN_CHAR",
      "position" : 3
    },
    {
      "token" : "来自",
      "start_offset" : 5,
      "end_offset" : 7,
      "type" : "CN_WORD",
      "position" : 4
    },
    {
      "token" : "海上",
      "start_offset" : 7,
      "end_offset" : 9,
      "type" : "CN_WORD",
      "position" : 5
    }
  ]
}

技术分享图片

OK,安装完毕,非常的简单。

ES-windos环搭建-ik中文分词器

原文:https://www.cnblogs.com/rixian/p/10746614.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!