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
- Host: GitHub
- URL: https://github.com/citrineinformatics/plugin-plussign
- Owner: CitrineInformatics
- Created: 2015-02-10T22:18:33.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T22:57:14.000Z (about 9 years ago)
- Last Synced: 2024-04-11T15:43:17.435Z (about 2 years ago)
- Language: Java
- Size: 10.7 KB
- Stars: 10
- Watchers: 7
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
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.