An open API service indexing awesome lists of open source software.

https://github.com/citrineinformatics/plugin-plussign

Custom Elasticsearch plugin example
https://github.com/citrineinformatics/plugin-plussign

Last synced: about 1 year ago
JSON representation

Custom Elasticsearch plugin example

Awesome Lists containing this project

README

          

# plugin-plussign

## Installation

Clone this repository in `///plugins` where `//` is the path to your Elasticsearch installation. From `///plugins/plugin-plussign`, run the following command:

javac -cp ../../lib/*:. io/citrine/pluginplussign/plugin/PlusSignPlugin.java

This will compile the plugin against your ElasticSearch installation and, since it resides in the plugins directory, it can be used as a plugin right away.

## Running the plugin

1. Start elasticsearch with e.g. bin/elasticsearch
2. If you do not have any indexes, create one using:

curl -XPUT 'localhost:9200/test'

3. Test the analyzer:

curl -XGET 'localhost:9200/test/_analyze?analyzer=plus_sign&pretty=true' -d 'This+is++some+text'

You should see the following response from Elasticsearch:

{
"tokens" : [ {
"token" : "this",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 1
}, {
"token" : "is",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 2
}, {
"token" : "some",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 3
}, {
"token" : "text",
"start_offset" : 0,
"end_offset" : 0,
"type" : "word",
"position" : 4
} ]
}

At this point you can use the `plus_sign` analyzer just as you would any of the built-in Elasticsearch analyzers.