# Plugin \[sample\] is incompatible with Elasticsearch \[2.4.1\]. Was designed for version \[2.3.3\]

**URL:** <https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098>\
**Category:** Elasticsearch\
**Created:** [October 15, 2016, 10:07am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098 "2016-10-15T10:07:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 15, 2016, 10:07am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/1 "2016-10-15T10:07:03Z")

</div>

I m new in elasticsearch.Trying to create a plugin for elasticsearch.  
Got a sample code from  
[https://codeload.github.com/codelibs/elasticsearch-plugin-sample/zip/master](https://codeload.github.com/codelibs/elasticsearch-plugin-sample/zip/master)  
after build with maven got error  
ERROR: Plugin [sample] is incompatible with Elasticsearch [2.4.1]. Was designed for version [2.3.3].  
Please help to solve this issue.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 15, 2016, 11:06am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/2 "2016-10-15T11:06:59Z")

</div>

You want to read: [https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html](https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html)

---

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 15, 2016, 1:52pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/3 "2016-10-15T13:52:56Z")

</div>

thanks for suggestion now my plugin is working.  
But i have a problem when start elasticsearch after installed my plugin it give a exception Exception in thread "main" ElasticsearchException[failed to load custom hash function [org.elasticsearch.plugin.direct.DirectRoutingHash]  
Please suggest what i m doing wrong.  
some change in my elasticsearch.yml  
cluster.routing.operation.hash.type: org.elasticsearch.plugin.direct.DirectRoutingHash

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 15, 2016, 3:23pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/4 "2016-10-15T15:23:14Z")

</div>

I gave a quick look at your code here: [https://github.com/codelibs/elasticsearch-plugin-sample/](https://github.com/codelibs/elasticsearch-plugin-sample/)

Note that it has not been updated for 2.4.

I don't know what is wrong.

But what is this `org.elasticsearch.plugin.direct.DirectRoutingHash` class? It's not in your code, right?

---

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 15, 2016, 4:06pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/5 "2016-10-15T16:06:44Z")

</div>

Actually i m facing a problem with routing and shard. i have 20 shard but when my code send routing value 0- 20 ,there are lots of shard empty on elasticsearch .so i am trying to create a plugin with the help of sample plugin code which send routing value to the particular shard.  
please suggest if you have any other solution.  
thanks

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 15, 2016, 8:00pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/6 "2016-10-15T20:00:41Z")

</div>

If you want to send data to a specific shard, and you want to address 20 shards, why don't you simply use 20 indices with one shard each?

---

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 16, 2016, 4:51am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/7 "2016-10-16T04:51:11Z")

</div>

Hi jorg  
Thanks for suggestion, but my use case is different where I can't apply this methodology to create number of indices.please suggest me ,is there any way to create one indices and one type but my docs are distributed equally along all shards using routing key.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 16, 2016, 6:35am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/8 "2016-10-16T06:35:54Z")

</div>

What is your use case?

---

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 16, 2016, 7:25am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/9 "2016-10-16T07:25:56Z")

</div>

Actually this is not for development it is for production.i wanted to upgrade elasticsearch to 1.7 to 2.4.our data is equally distributed over production with the help of direct routing plugin but when I upgrade it to 2.4 there are lots of shard are empty and we are not able to change any method on [production.so](http://production.so) we have only choice to upgrade our plugin and move all data.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 16, 2016, 9:19am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/10 "2016-10-16T09:19:46Z")

</div>

Why do you use routing in the first place?

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 16, 2016, 2:54pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/11 "2016-10-16T14:54:34Z")

</div>

From what I understand, @Sandeep_Verma wants to use a numbering scheme trying to map the `routing` parameter of a document [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-routing-field.html) to a shard ID, which is not possible because of hashing.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 16, 2016, 3:04pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/12 "2016-10-16T15:04:48Z")

</div>

> [@Sandeep\_Verma](#):
>
> i wanted to upgrade elasticsearch to 1.7 to 2.4.our data is equally distributed over production with the help of direct routing plugin but when I upgrade it to 2.4 there are lots of shard are empty and we are not able to change any method on production.so we have only choice to upgrade our plugin and move all data.

Can you show the source code of the plugin?

Note that Elasticsearch by default maps documents equally distributed to shards, so I wonder what the purpose of your so-called "direct routing" is. Fact is, Elasticsearch does direct routing by hashing doc IDs to shard IDs.

In Elasticsearch philosophy, clients must not have intimate knowledge how the cluster routes documents by hashing internally. The only method is giving a "routing key" as input, which is hashed. This is important, because shard count is internal, and also, internal hashing algorithm may change from major version to version.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 16, 2016, 3:38pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/13 "2016-10-16T15:38:09Z")

</div>

Sure. But what for? What problem is he trying to solve by doing so?  
I probably misunderstand the problem.

---

<div class="post-metadata">

**Author:** ![Sandeep\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeep_verma/32/12517_2.png) [@Sandeep\_Verma](https://discuss.elastic.co/u/Sandeep_Verma)\
**Post date:** [October 17, 2016, 7:01am UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/14 "2016-10-17T07:01:53Z")

</div>

You can see plugin code here

> **[sandeep-verma/elastic-direct-routing](https://github.com/sandeep-verma/elastic-direct-routing/)**
>
> Contribute to elastic-direct-routing development by creating an account on GitHub.

---

<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:** [July 5, 2017, 10:11pm UTC](https://discuss.elastic.co/t/plugin-sample-is-incompatible-with-elasticsearch-2-4-1-was-designed-for-version-2-3-3/63098/15 "2017-07-05T22:11:50Z")

</div>


