# Similarity plugin usage in the latest version of ES 5.3

**URL:** <https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033>\
**Category:** Elasticsearch\
**Created:** [June 20, 2017, 5:23am UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033 "2017-06-20T05:23:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun\_Ramachandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arun_ramachandran/32/19736_2.png) [@Arun\_Ramachandran](https://discuss.elastic.co/u/Arun_Ramachandran)\
**Post date:** [June 20, 2017, 5:23am UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033/1 "2017-06-20T05:23:23Z")

</div>

I've created a similarity plugin but I am unable to use the same in ES 5.3.  
I am able to use the same plugin in 1.7.6 version and it's working too.  
But I'm fearing that if I stick to old version, I'll loose all the new features and fixes available till now.  
Could anybody suggest what's the method to use similarity plugin in latest versions 5.x?

I've seen a similar post (below), but looks like it just closed today!

> [@Is it fine to use older version of ES](https://discuss.elastic.co/t/is-it-fine-to-use-older-version-of-es/85325):
>
> I wanted to create a similarity plugin but I am unable to do in in ES latest version. I am able to create a plugin in 1.7.6 version and it's working too. So is it fine to proceed with that version or should I upgrade to the existing latest version. If I have to upgrade then I need a solution for my plugin. Please help me in this regard. Thank you.

I want to use my plugin in the new version. Please help me to solve this issue or provide any ES docs if any.  
That would be a great help.

Thank you.

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [June 23, 2017, 8:04pm UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033/2 "2017-06-23T20:04:51Z")

</div>

In ES 5.x, the way to do this is by overriding the `onIndexModule` method of `Plugin`. You would then call something like this:

```auto
indexModule.addSimilarity("my_sim_name", (name, providerSettings, indexSettings) ->
 new SimilarityProvider() {
   @Override
   public String name() {
       return name;
   }

   @Override
   public Similarity get() {
       return /* CONSTRUCT YOUR SIMILARITY*/;
   }  
});

```

Note that this will most likely change again at some point in the future, as we have been moving to pull based plugins, while this is still a push based api (ie `addFoo`).

---

<div class="post-metadata">

**Author:** ![Arun\_Ramachandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arun_ramachandran/32/19736_2.png) [@Arun\_Ramachandran](https://discuss.elastic.co/u/Arun_Ramachandran)\
**Post date:** [July 4, 2017, 4:05am UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033/3 "2017-07-04T04:05:38Z")

</div>

Thanks Ryan for your response.  
We are checking this and respond to you about our results.

---

<div class="post-metadata">

**Author:** ![Arun\_Ramachandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arun_ramachandran/32/19736_2.png) [@Arun\_Ramachandran](https://discuss.elastic.co/u/Arun_Ramachandran)\
**Post date:** [July 7, 2017, 11:23am UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033/4 "2017-07-07T11:23:52Z")

</div>

Thanks Ryan.  
It solved our confusion, and its working. 😂

---

<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:** [August 4, 2017, 11:24am UTC](https://discuss.elastic.co/t/similarity-plugin-usage-in-the-latest-version-of-es-5-3/90033/5 "2017-08-04T11:24:13Z")

</div>

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