Creating a plugin
Native plugins allow several aspects of the Elasticsearch server to be extended, but they require a good knowledge of Java.
In this recipe we will see how to set up a working environment to develop native plugins.
Getting ready
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
A Maven tool, or an IDE that supports Java programming, such as Eclipse or IntelliJ IDEA, is required.
The code to this recipe is available in the chapter17/simple_plugin
directory.
How to do it...
Generally, Elasticsearch plugins are developed in Java using the Maven build tool and deployed as a ZIP file.
To create a simple JAR plugin, we will perform the following steps:
To correctly build and serve a plugin, some files must be defined:
pom.xml
is used to define the build configuration for Maven.es-plugin.properties
defines the namespace of the plugin class that must be loaded.<name>plugin...