Creating a REST plugin
The previous recipe described how to set up a working environment and the steps required to build a native plugin. In this recipe, we will see how to create one of the most common ElasticSearch plugins: the REST plugin.
This kind of plugin allows you to extend the standard REST calls with custom ones to easily improve the capabilities of ElasticSearch.
In this recipe, we will see how to define a REST entry point and create its action. In the next recipe, we will see how to execute this action and distribute it in shards.
Getting ready
You will need a working ElasticSearch node, a Maven build tool, and an optional Java IDE. The code of this recipe is available in the chapter12/rest_plugin
directory in the code bundle of the same chapter, which can be downloaded from the Packt Publishing website.
How to do it...
To create a REST entry point, we first need to create the action and then register it in the plugin. Perform the following steps:
- Create a REST simple action (
RestSimpleAction...