问题
I am currently trying to write an Elasticsearch plugin (mainly for testing purposes), and I am struggling with the documentation which simply states:
These examples provide the bare bones needed to get started. For more information about how to write a plugin, we recommend looking at the plugins listed in this documentation for inspiration.
So basically, after finding a few tutorials (which kind of disagree with each other besides the maven part), see http://david.pilato.fr/blog/2016/07/27/creating-a-plugin-for-elasticsearch-5-dot-0-using-maven/ and http://jfarrell.github.io (they don't inherit the same classes).
I am actually stuck where to start, what components are available from the core elasticsearch dependency, and how should I load my plugin. (I know I can look into it by testing and retro engineering, I just wondered if anyone had good tips regarding the topic).
For now my code just looks like:
public class MyPlugin extends Plugin implements NativeScriptFactory{
//overriden methods
}
Where should I go from there?
Thank you very much!
回答1:
@asttouf
I recently wrote a plugin to EL 2.3.x (https://github.com/betorcs/elastic-recurring-plugin). It was hard to find a documentation saying steps to follow to write it. I needed to google at lot to find some references.
I'm listing some projects I used as reference, i hope they can help you.
- https://github.com/elastic/elasticsearch/tree/master/plugins/ingest-attachment
- https://github.com/elastic/elasticsearch-mapper-attachments
- https://www.elastic.co/blog/found-writing-a-plugin
- http://www.flax.co.uk/blog/2016/01/27/fun-frustration-writing-plugin-elasticsearch-ontology-indexing/
EDITED
More references:
- https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-scripting-native.html
- https://www.elastic.co/blog/writing-your-own-ingest-processor-for-elasticsearch
Plugin updated to support ES 5.0, check out https://github.com/betorcs/elastic-recurring-plugin/tree/5.0
来源:https://stackoverflow.com/questions/42652584/elasticsearch-5-how-to-start-writing-a-native-java-plugin