# Writing a plugin over Elasticsearch

**URL:** <https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322>\
**Category:** Elasticsearch\
**Created:** [February 17, 2018, 7:12pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322 "2018-02-17T19:12:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhilash\_Bolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_bolla/32/26840_2.png) [@Abhilash\_Bolla](https://discuss.elastic.co/u/Abhilash_Bolla)\
**Post date:** [February 17, 2018, 7:12pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/1 "2018-02-17T19:12:12Z")

</div>

Hi,

I been searching all over Google to get started with writing a plugin on Elasticsearch 5. I haven't been able to find material substantial material for the same. Please assist on the same.

Thanks

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 18, 2018, 6:39am UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/2 "2018-02-18T06:39:56Z")

</div>

The best approach is to look at other existing plugins. The github repo has  
a few: [https://github.com/elastic/elasticsearch/tree/master/plugins/examples](https://github.com/elastic/elasticsearch/tree/master/plugins/examples)

The example plugins are written for 6.x, but little has changed since 5.x.  
At the Java code level, everything should be the same. Both version use the  
new gradle build system, but there have been a few bug fixes throughout 5.x  
into 6.x. I documented some of the changes in a minimal plugin:  
[https://github.com/brusic/plugin-with-fixture-skeleton](https://github.com/brusic/plugin-with-fixture-skeleton) One big issue with  
the Elasticsearch examples is that it depends on the overall gradle build,  
so there are important pieces missing from the build.gradle file. Look at  
non-Elastic plugins, such as the one I referenced, for insights.

I will be giving a tutorial on writing plugins this week, but it will be  
very far from you. 😉

Cheers,

Ivan

---

<div class="post-metadata">

**Author:** ![tsvet](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@tsvet](https://discuss.elastic.co/u/tsvet)\
**Post date:** [February 18, 2018, 1:51pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/3 "2018-02-18T13:51:07Z")

</div>

yes, Ivan gave you a good hint. Look at the other plugins  
e.g. [https://github.com/floragunncom/search-guard/tree/ves-5.5.2-16](https://github.com/floragunncom/search-guard/tree/ves-5.5.2-16) this one is for 5.5.2

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 18, 2018, 3:25pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/4 "2018-02-18T15:25:54Z")

</div>

While it is great to also have an example of a plugin built via maven, I  
would highly encourage using the gradle plugin instead. Cuts down on the  
amount of work tremendously. In Elasticsearch 6.3, the directory layout of  
plugins will change, but if you use the gradle plugin, you will not have to  
change your code at all since the plugin will take care of the layout.

---

<div class="post-metadata">

**Author:** ![Abhilash\_Bolla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_bolla/32/26840_2.png) [@Abhilash\_Bolla](https://discuss.elastic.co/u/Abhilash_Bolla)\
**Post date:** [February 18, 2018, 4:07pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/5 "2018-02-18T16:07:48Z")

</div>

@Ivan Is it possible to have a video recording of the talk you are gonna deliver at [this meetup](https://www.meetup.com/Elasticsearch-Los-Angeles/events/244376045/) on writing plugins?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 18, 2018, 11:49pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/6 "2018-02-18T23:49:19Z")

</div>

Hi Abhilash,

It is up to the organizer and/or host to have the ability to record and  
distribute video, which I do not know if they have. I will happily give  
consent to release any video.

My personal speaking style is not to read directly from slides, but to have  
them as reference points, which means the slides by themselves are not an  
ideal presentation. Still I will share them for you. The talk will not be a  
deep dive, but more of an overview alongside talking about some of the  
issues I have come across. You are still probably better off reading code  
and asking questions. 🙂 The gradle plugin plugin does help alleviate many  
issues, but itself had some bugs in 5.x. I recommend using 5.4+ (sadly, I  
no longer remember the issues pre 5.4).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 18, 2018, 11:54pm UTC](https://discuss.elastic.co/t/writing-a-plugin-over-elasticsearch/120322/7 "2018-03-18T23:54:55Z")

</div>

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