Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jhjguxin/5e51ca18555a7fe9d641 to your computer and use it in GitHub Desktop.
Save jhjguxin/5e51ca18555a7fe9d641 to your computer and use it in GitHub Desktop.
config zh-cn elasticsearch plugin
https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.2.6.zip
unzip v1.2.6.zip


sudo -i

cd /usr/share/elasticsearch
cd plugins
bin/plugin -install medcl/elasticsearch-analysis-ik/1.2.6

but not work

从 rtf 里面抽取需要的文件 到 elasticsearch_ch

$ tree elasticsearch_ch/ -L 2
elasticsearch_ch/
├── config
│   ├── elasticsearch.yml
│   ├── ik
│   └── mmseg
└── plugins
    ├── analysis-ik
    └── analysis-mmseg

并且配合 elasticsearch.yml 如下

path.conf: /usr/share/elasticsearch/config
path.plugins: /usr/share/elasticsearch/plugins


#################################### Plugin ###################################

# If a plugin listed here is not installed for current node, the node will not start.
#
#plugin.mandatory: mapper-attachments,lang-groovy

index:
  analysis:
    tokenizer:
      mmseg_maxword:
          type: mmseg
          seg_type: "max_word"
      mmseg_complex:
          type: mmseg
          seg_type: "complex"
      mmseg_simple:
          type: mmseg
          seg_type: "simple"
    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
      mmseg:
          alias: [news_analyzer, mmseg_analyzer]
          type: org.elasticsearch.index.analysis.MMsegAnalyzerProvider
      mmseg_maxword:
          type: custom
          filter: [lowercase]
          tokenizer: mmseg_maxword
      mmseg_complex:
          type: custom
          filter: [lowercase]
          tokenizer: mmseg_complex
      mmseg_simple:
          type: custom
          filter: [lowercase]
          tokenizer: mmseg_simple
#index.analysis.analyzer.default.type: mmseg
index.analysis.analyzer.default.type: ik

/etc/elasticsearch/elasticsearch.yml

http://zhousheng29.iteye.com/blog/1849536

scp -P 40022 -r /home/jhjguxin/temp/elasticsearch_ch   ikcrm_dev@test1.vkelai.com:~/
sudo cp -r elasticsearch_ch/plugins/ /usr/share/elasticsearch/
sudo cp -r elasticsearch_ch/config/ /etc/elasticsearch/
cd /etc/elasticsearch/
sudo mv elasticsearch.yml elasticsearch.yml.bak
sudo cp -f config/elasticsearch.yml /etc/elasticsearch/
sudo cp logging.yml config/

sudo vim elasticsearch.yml

#path.conf: /path/to/conf
path.conf: /etc/elasticsearch/config

#path.plugins: /path/to/plugins
path.plugins: /usr/share/elasticsearch/plugins


sudo /etc/init.d/elasticsearch restart

cd /dyne/apps/vcooline_ikcrm_development/current/
RAILS_ENV=production bundle exec rake chewy:reset:all

curl -XPOST "localhost:9200/ikcrm_development_entities/_analyze?analyzer=ik" -d'
{
    "text" : "女士冲锋衣"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment