Elasticsearch version : 7.7
In this article, we will be using docker-compose to create a container with plugin pre-installed.
Core Plugin
Plugins that maintained by Elasticsearch team. List of plugin: doc.
-
Create a
docker-compose.yml
file :1 2 3 4 5 6 7 8 9 10 11 12 13 14
version: '2' services: es_v7: image: elasticsearch:7.7.0 environment: - node.name=es01 - cluster.name=es-docker-cluster - discovery.type=single-node ports: - "9200:9200" volumes: - .:/mnt entrypoint: /mnt/docker-entrypoint-es.sh
- Set
discovery.type=single-node
if you intented to run single node mode. - Port is exposed to
9200
. - The location of the script is mount to
/mnt
directory in the container.
- Set
-
Create a script file
docker-entrypoint-es.sh
:1 2 3 4 5
#!/bin/bash bin/elasticsearch-plugin install analysis-phonetic exec /usr/local/bin/docker-entrypoint.sh elasticsearch
-
Run
docker-compose up
.
Custom Plugin
Custom plugins that developed by community.
-
Create
docker-compose.yml
file
(Refer Core Plugin - Step 1) -
Create a directory (e.g: analysis-plugin) same location as
docker-compose.yml
.
E.g. -
Move the plugin jars and properties into the created directory.
E.g.
In my case, I’m trying to import analysis-pinyin which has artifacts of 2 jars + 1 properties file. -
Create a script file
docker-entrypoint-es.sh
:1 2 3 4 5
#!/bin/bash cp -R /apps/<custom-plugin> /usr/share/elasticsearch/plugins exec /usr/local/bin/docker-entrypoint.sh elasticsearch
-
Run
docker-compose up
.
Validate
Validate is the plugin successfully installed by using Elasticsearch cat plugin api.