This article installs version 6.8 of ElasticSearch. Other versions only need to change the version number.

Note: ik participle version number and es version must be consistent, otherwise installation error!

Install ElasticSearch using Docker

Pull the mirror

Docker pull elasticsearch: 6.8.0

Copy the code

Check whether the mirror is successfully pulled

docker images

Copy the code

Create a mapping folder and configuration file

My computer is a MAC, and the same applies to Linux.

mkdir -p /docker/elasticsearch/config

mkdir -p /docker/elasticsearch/data

echo "HTTP. Host: 0.0.0.0." ">>/docker/elasticsearch/config/elasticsearch.yml

The configuration file is of type yml. Note that there is a space after http.host:

Copy the code

Folder authorization

chmod -R 777 /docker/elasticsearch/

Copy the code

Create a container

docker run --name elasticsearch -p 9200:9200 \

 -p 9300:9300 \

 -e "discovery.type=single-node" \

 -e ES_JAVA_OPTS="-Xms64m -Xmx128m" \

  -v /docker/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \

 -v /docker/elasticsearch/data:/usr/share/elasticsearch/data \

 -v /docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins \

- d elasticsearch: 6.8.0

Copy the code

View the results

docker ps

Copy the code

Browser access: http://127.0.0.1:9200/

Set the container to start with Docker

docker update elasticsearch --restart=always

Copy the code

Installation successful!

Ik word segmentation is configured

Continue with the above

Download the IK segmented plug-in

Again, the ik participle version needs to be consistent with the ES version.

https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.0/elasticsearch-analysis-ik-6.8.0.zip

Copy the code

The above link is too slow to download, I uploaded ik to my web disk. Note that the version is 6.8.

http://xuewei.world/moti-cloud/file/share?t=96c9c1d7-a&f=230&p=16101058210004408&flag=1

Copy the code

Download it and unzip it and rename it ik.

Move the IK inside the Docker container

Put the unzipped ik folder under/TMP, and then copy the IK into the docker container.

docker cp /tmp/ik elasticsearch:/usr/share/elasticsearch/plugins

Copy the code

Restart the container

docker restart elasticsearch

Copy the code

Use PostMan tests

Success!