Maven Archetype for Elasticsearch plugin
Java Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Elasticsearch Plugin Archetype


This project (elasticsearch-plugin-archetype) provides Maven archetype for Elasticsearch plugin. You can easily create your elasticsearch plugin by this archetype.


Version elasticsearch
master 2.3.X
2.3.0 2.3.3
1.5.0 1.5.2
1.4.0 1.4.0.Beta1
1.3.0 1.3.0
1.2.0 1.2.1
1.1.0 1.0.0.RC2
1.0.0 0.90.5


Please file an issue. (Japanese forum is here.)


Using archetype:generate goal of Maven, run the following command:

$ mvn archetype:generate \
    -DarchetypeGroupId=org.codelibs \
    -DarchetypeArtifactId=elasticsearch-plugin-archetype \
    -DarchetypeVersion=2.3.0 \
    -DelasticsearchVersion=2.3.3 \
    -DgroupId=<Your groupId> \
    -DartifactId=<your artifactId> \
    -Dversion=<your version> \
    -DpluginName=<your plugin name> \
    -DrestName=<your rest API name>

Properties description is below:

Property Name Description Example
elasticsearchVersion Elasticsearch version 2.3.3
groupId Project's groupId com.example
artifactId Project's artifactid elasticsearch-hello
version Project's version 1.0-SNAPSHOT
pluginName Plugin class name Hello
restName Rest API name hello

elasticsearchVersion and restName are optional.

For example, the command is below:

$ mvn archetype:generate \
    -DarchetypeGroupId=org.codelibs \
    -DarchetypeArtifactId=elasticsearch-plugin-archetype \
    -DarchetypeVersion=2.3.0 \
    -DgroupId=com.example \
    -DartifactId=elasticsearch-hello \
    -Dversion=1.0-SNAPSHOT \

Create Service

A service component is generated as <pluginName>Module and <pluginName>Service classes. You can put your code into <pluginName>Service. <pluginName>Service is injected to other components in elasticsearch.

If a service is not necessary, remove <pluginName>Module, <pluginName>Service and the definistion in <pluginName>Plugin class.

Create Rest API

A class file for Rest API is <pluginName>RestAction. You can put your code into <pluginName>RestAction. The urls to access to <pluginName>RestAction are:


The definistion is in a constructor of <pluginName>RestAction.

If a rest API is not necessary, remove <pluginName>RestAction class and the definistion in <pluginName>Plugin class.