-
Notifications
You must be signed in to change notification settings - Fork 0
[Elasticsearch] Install ik plugin with docker image
Jinxin Chen edited this page Dec 11, 2019
·
1 revision
Here is the official docker image of elasticsearch :
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
You can follow this article to setup elasticsearch in your environment easily.
Here is an example to build your own image based on the official image:
FROM docker.elastic.co/elasticsearch/elasticsearch:5.3.0
RUN mkdir plugins/ik
RUN wget -P plugins/ik https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.3.0/elasticsearch-analysis-ik-5.3.0.zip
RUN unzip -d plugins/ik/ plugins/ik/elasticsearch-analysis-ik-5.3.0.zip
EXPOSE 9200 9300
The image will build with ik which's version is 5.3.0. You can get which version you should install from here : https://github.com/medcl/elasticsearch-analysis-ik.
Elasticsearch will auto install plugins in the plugins folder, so what you need to do is download plugins to the folder.
- Create index.
PUT /blog
- Stop index created above.
You can't change the default analyzer to an opened index, so you must close it first.
POST /blog/_close
- Set analyzer
PUT /blog/_settings
{
"index":{
"analysis" : {
"analyzer" : {
"default" : {
"type" : "ik_smart"
}
}
}
}
}
- Open index
POST /blog/_open
Now you can check whether the default analyzer was changed successfully:
GET /blog/_settings