Creating an analyzer plugin
ElasticSearch provides, out of the box, a large set of analyzers and tokenizers to cover general standard needs. Sometimes we need to extend the capabilities of ElasticSearch adding new analyzers.
Typically you need to create an analyzer plugin when you need to add standard Lucene analyzers/tokenizers not provided by ElasticSearch, to integrate third-party analyzers, and to add custom analyzers.
In this recipe we will add a new custom English analyzer similar to the one provided by ElasticSearch.
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/analysis_plugin directory.
How to do it...
An analyzer plugin is generally composed by the following classes:
- A plugin class, which registers
BinderProcessor - A
BinderProcessorclass, which registers one or moreAnalyzerProvidersclasses - An
AnalyzerProvidersclass, which provides an analyzer
For creating an analyzer plugin, we...