Help for plugin authors
editHelp for plugin authors
editThe Elasticsearch repository contains examples of:
- a site plugin for serving static HTML, JavaScript, and CSS.
- a Java plugin which contains Java code.
These examples provide the bare bones needed to get started. For more information about how to write a plugin, we recommend looking at the plugins listed in this documentation for inspiration.
Site plugins
The example site plugin mentioned above contains all of the scaffolding needed for integrating with Maven builds. If you don’t plan on using Maven, then all you really need in your plugin is:
-
The
plugin-descriptor.properties
file -
The
_site/
directory -
The
_site/index.html
file
Plugin descriptor file
editAll plugins, be they site or Java plugins, must contain a file called
plugin-descriptor.properties
in the root directory. The format for this file
is described in detail here:
dev-tools/src/main/resources/plugin-metadata/plugin-descriptor.properties
.
Either fill in this template yourself (see
elasticsearch-kopf
as an example) or, if you are using Elasticsearch’s Maven build system, you
can fill in the necessary values in the pom.xml
for your plugin. For
instance, see
plugins/site-example/pom.xml
.
Mandatory elements for all plugins
editElement | Type | Description |
---|---|---|
|
String |
simple summary of the plugin |
|
String |
plugin’s version |
|
String |
the plugin name |
Mandatory elements for Java plugins
editElement | Type | Description |
---|---|---|
|
Boolean |
true if the |
|
String |
the name of the class to load, fully-qualified. |
|
String |
version of java the code is built against.
Use the system property |
|
String |
version of elasticsearch compiled against. |
Plugin release lifecycle
You will have to release a new version of the plugin for each new elasticsearch release.
This version is checked when the plugin is loaded so Elasticsearch will refuse to start
in the presence of plugins with the incorrect elasticsearch.version
.
Mandatory elements for Site plugins
editElement | Type | Description |
---|---|---|
|
Boolean |
true to indicate contents of the |
Testing your plugin
editWhen testing a Java plugin, it will only be auto-loaded if it is in the
plugins/
directory. Use bin/plugin install file:///path/to/your/plugin
to install your plugin for testing.
You may also load your plugin within the test framework for integration tests. Read more in Changing Node Configuration.