Loading

EleasticSearch:1.7.6 Docker安装、使用IK分词器配置

EleastaticSearch.yml配置

注意!这仅仅只是让你的ElasticSearch迅速跑起来的配置,上生产还需要配置集群、性能等各种参数

#集群名称
cluster.name: elasticsearch-outer

# 节点名称
node.name: "es-129-outer"

# 是否作为master节点
node.master: true

# 是否作为数据存储节点
node.data: true

# 允许访问的IP
network.host: 0.0.0.0

# transportClient端口(java代码)
transport.tcp.port: 9300

# http端口
http.port: 9200

# 配置跨域,使用ElasticSearch-head插件时,要配上
http.cors.enabled: true
http.cors.allow-origin: "*"

#配置IK分词器,据原作者在Github提示,低版本ES需要配置,高版本ES貌似不用配置
index:
  analysis:
    analyzer:
      ik:
          alias: [ik_analyzer]
          type: org.elasticsearch.index.analysis.IkAnalyzerProvider
      ik_max_word:
          type: ik
          use_smart: false
      ik_smart:
          type: ik
          use_smart: true

# 具体如何安装plugin,直接在github上搜索IK,选择对应版本观看即可

IK分词器安装后的目录

image-20211112184442437

测试IK分词器是否安装成功

curl -XPUT http://localhost:9500/index

curl 'http://localhost:9500/index/_analyze?analyzer=ik_max_word&pretty=true' -d' 
{ 
    "text":"中华人民共和国国歌" 
} 
'
posted @ 2021-11-12 18:47  向北zz  阅读(235)  评论(0编辑  收藏  举报

Loading