Creating a simple plugin
In the previous recipe we saw the site plugin, but ElasticSearch allows creating a most powerful type of plugin, the native JAR ones.
Native plugins allow extending several aspects of the ElasticSearch server, but they require good Java knowledge. Because they are compiled in native JVM, they are generally very fast.
In this recipe we will see how to set up a system to develop native plugins.
Getting ready
You need a working ElasticSearch node, a Maven built tool, and an optional Java IDE. The code of this recipe is available in the chapter12/simple_plugin
directory.
How to do it...
Generally ElasticSearch plugins are developed in Java using the Maven built tool and deployed as a ZIP file.
For creating a simple JAR plugin, we need to perform the following steps:
- To correctly build and serve a plugin, the following files must be defined:
pom.xml
: This is used to define the build configuration for Maven.es-plugin.properties
: This defines the namespace of the plugin class that...