# Call when shard reallocation occurs

**URL:** <https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395>\
**Category:** Elasticsearch\
**Created:** [August 21, 2014, 5:02pm UTC](https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395 "2014-08-21T17:02:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticSearch\_Users\_](https://avatars.discourse-cdn.com/v4/letter/e/b4bc9f/32.png) [@ElasticSearch\_Users\_](https://discuss.elastic.co/u/ElasticSearch_Users_)\
**Post date:** [August 21, 2014, 5:02pm UTC](https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395/1 "2014-08-21T17:02:19Z")

</div>

Hi,

Is it possible to have my custom callback function defined and invoked by  
ES whenever it moves a shard from one node to another?

Thanks,  
Sandeep

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [August 22, 2014, 12:49am UTC](https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395/2 "2014-08-22T00:49:45Z")

</div>

AFAIK, there is no way to achieve such functionality.

The only way I have figured out have similar functionality is to write a  
plugin with a cluster state listener and have the plugin reach out to some  
external service.

Cheers,

Ivan

On Thu, Aug 21, 2014 at 10:02 AM, 'Sandeep Ramesh Khanzode' via  
elasticsearch [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) wrote:

> Hi,
> 
> Is it possible to have my custom callback function defined and invoked by  
> ES whenever it moves a shard from one node to another?
> 
> Thanks,  
> Sandeep
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sandeep\_Ramesh\_Khanz](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sandeep\_Ramesh\_Khanz](https://discuss.elastic.co/u/Sandeep_Ramesh_Khanz)\
**Post date:** [August 22, 2014, 7:10am UTC](https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395/3 "2014-08-22T07:10:15Z")

</div>

Thanks, Ivan. Appreciate it. I will take a look at 'ClusterStateListener'.  
Meanwhile, if you have any ready reference available for this, like doc or  
example code, please share. Thanks!

On Fri, Aug 22, 2014 at 6:19 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> AFAIK, there is no way to achieve such functionality.
> 
> The only way I have figured out have similar functionality is to write a  
> plugin with a cluster state listener and have the plugin reach out to some  
> external service.
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Aug 21, 2014 at 10:02 AM, 'Sandeep Ramesh Khanzode' via  
> elasticsearch [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) wrote:
> 
> > Hi,
> > 
> > Is it possible to have my custom callback function defined and invoked by  
> > ES whenever it moves a shard from one node to another?
> > 
> > Thanks,  
> > Sandeep
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/9b792e04-8bd1-4006-93a2-f3d736cd8474%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/4fEahX9nhL0/unsubscribe](https://groups.google.com/d/topic/elasticsearch/4fEahX9nhL0/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDMCNNsvAv2r0bRsog6a2oow9bYSyQ-CZtcxtcgkUJtRQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKnM90a-CrxeUm4F4q889naxhcwNLrhYoZnsptQYZhi7gHL9pQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKnM90a-CrxeUm4F4q889naxhcwNLrhYoZnsptQYZhi7gHL9pQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:07am UTC](https://discuss.elastic.co/t/call-when-shard-reallocation-occurs/19395/4 "2017-07-06T01:07:03Z")

</div>


