What's the concept of making plugins

I'm new to developing elasticsearch plugins. I'm not sure what the concept is for the plugins. Are you essentially overwriting Elasticsearch objects and adding them to the classpath?


Yes, it amounts to writing Java code that is on the classpath. Technically each plugin is loaded in a child classloader so each plugin can load different versions of the same jar and still work. The cost of this is that plugins can't communicate with each other. I mean, we could write a system that'd let them communicate in a round about way but we haven't seen the need to do that and so we haven't.

To get the plugin loaded you need to make a few files in a zip file. You can make them yourself and put them where they need to be or you can use our build plugin which you apply like this: apply plugin: 'elasticsearch.esplugin'. I'm not 100% sure how you make sure gradle pulls it in.

The other funky thing about writing Elasticsearch plugins is that Elasticsearch runs in a relatively secured setup. It runs with the JVM's security turned on which means that plugins that need permissions that Elasticsearch doesn't grant itself need jump through a few hoops. One of the links above describes how you check for a permission. This is an example of a plugin that declares the extra permissions that it needs.

Finally, you actually stick your classes at the extension points by extending org.elasticsearch.plugins.Plugin and implementing one or more of the interfaces here. That really is the end of the "formal" plugin API. Beyond that all the APIs are internal and subject to change on every release.

Thanks Nik! I've been thinking about making a plugin, but wasn't sure of how it all worked.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.