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":"中華人民共和國國歌" 
} 
'


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM