Software engineers, developers and just about everyone else must be prepared to keep up with technological evolution.
While that means working with and in the cloud now, the future may lie in virtual reality or serverless technology. However, there is at least one constant: data — lots of data. To manage this data, software developers, engineers, and architects can rely on tools to parse and display information. One of those tools is Elasticsearch, a search and analytics engine.
Why choose Elasticsearch?
Elasticsearch offers its users many benefits, such as REST-based APIs, schema-free JSON documents, the ability to process large amounts of data in parallel, and integrations with plugins and tools, such as Kibana, Beats, and Logstash.
Before users can achieve these benefits, they must overcome a steep learning curve. To help with that, Elasticsearch 8.x cookbookfifth edition, provides readers with recipes to perform searches and other tasks.
For those unfamiliar with what a recipe is – at least when it comes to Elasticsearch – recipe is the technical name for the way the web calls services, explains Alberto Paro, an engineer, manager, and software developer at Accenture Italia, and the author of Elasticsearch 8.x cookbookFifth Edition.
Elasticsearch allows technicians to perform many tasks in many areas by leveraging its search and analytics capabilities. “I use these kinds of capabilities in different markets, to track automobility and travel, to healthcare, to be able to search massive amounts of data,” Paro said. “… Every day I have a new challenge with these kinds of tools.”
This book covers 18 different tasks — including mapping, scripting, cluster management, plugin development, and big data integration — broken down into smaller steps.
For example, this excerpt from Chapter 16 explains how to create a plugin.
In general, Elasticsearch plugins are developed in Java using the Gradle build tool (https://gradle.org/) and implemented as a ZIP file.
To create a simple JAR plugin, let’s take the following steps:
- To properly build and operate a plugin, some files need to be defined:
- build.gradle and settings.gradle are used to define the build configuration for Gradle.
- LICENSE.txt defines the plugin license.
- NOTICE.txt is a copyright notice.
- A build.gradle file is used to create a plugin that contains the following code:
buildscript { repositories { mavenCentral() } dependencies { classpath "org.elasticsearch.gradle:build-tools:8.0.0" } } repositories { mavenCentral() } group = 'org.elasticsearch.plugin' version = '8.0.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'idea' apply plugin: 'elasticsearch.esplugin' apply plugin: 'elasticsearch.yaml-rest-test' esplugin { name 'simple-plugin' description 'A simple plugin for ElasticSearch' classname 'org.elasticsearch.plugin.simple.SimplePlugin' // license of the plugin, may be different than the above license licenseFile rootProject.file('LICENSE.txt') // copyright notices, may be different than the above notice noticeFile rootProject.file('NOTICE.txt') } // In this section you declare the dependencies for your production and test code // Note, the two dependencies are not really needed as the buildscript dependency gets them in already // they are just here as an example dependencies { implementation 'org.elasticsearch:elasticsearch:8.0.0' yamlRestTestImplementation 'org.elasticsearch.test:framework:8.0.0' } // ignore javadoc linting errors for now tasks.withType(Javadoc) { options.addStringOption('Xdoclint:none', '-quiet') }
- The settings.gradle file is used for the project name as follows:
rootProject.name = 'simple-plugin'
- The src/main/java/org/elasticsearch/plugin/simple/SimplePlugin.java class is an example of the basic (minimum required) code that must be compiled to run a plugin, as follows:
package org.elasticsearch.plugin.simple; import org.elasticsearch.plugins.Plugin; public class SimplePlugin extends Plugin { }
From here on, the chapter explains in separate sections how this plugin works and what it takes to create a good plugin lifecycle.

“Plugins give you [the] ability to extend Elasticsearch with anything you want,” Paro said. He added that, for example, users can create a plugin to manage machine learning activities. “Elasticsearch is not a monolithic application, but is a tool that can grow with your business needs, and plug-in development is one of the key areas for extending Elasticsearch.”
Editor’s Note: This chapter excerpt is from: Elasticsearch 8.x cookbookFifth Edition, written by Alberto Paro, published by Packt Publishing, May 27, 2022, ISBN: 9781801079815. To read Chapter 16 of the book in its entirety, click here†