# Access to client from a script plugin

**URL:** <https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598>\
**Category:** Elasticsearch\
**Created:** [March 22, 2017, 2:28pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598 "2017-03-22T14:28:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![redhelling21](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redhelling21/32/16605_2.png) [@redhelling21](https://discuss.elastic.co/u/redhelling21)\
**Post date:** [March 22, 2017, 2:28pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598/1 "2017-03-22T14:28:00Z")

</div>

Hello,  
I am currently studying different tools for identity resolution in a big amount of data, and I found [this one](https://github.com/YannBrrd/elasticsearch-entity-resolution). The only problem is that the main developper stopped at ES 2.4.2, so I am trying to port it to ES 5.2...  
In the old version, custom settings are stored in a given index using a reference to the client, provided during the plugin initialization. But this functionality is not in ES 5+ anymore, so I am looking for a way to get a reference to the client from the script plugin.  
Is such a thing possible ?

Thank you

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 22, 2017, 2:43pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598/2 "2017-03-22T14:43:51Z")

</div>

It is probably possible but we don't encourage it. We didn't want scripts doing potentially blocking operations while they are running. Ideally, we'd like scripts to be totally idempotent.

---

<div class="post-metadata">

**Author:** ![redhelling21](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redhelling21/32/16605_2.png) [@redhelling21](https://discuss.elastic.co/u/redhelling21)\
**Post date:** [March 22, 2017, 2:47pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598/3 "2017-03-22T14:47:05Z")

</div>

I see, thank you for your reply...  
So the best practice would be to pass the settings as parameters with each query ?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 22, 2017, 3:09pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598/4 "2017-03-22T15:09:39Z")

</div>

Depending on the kind of settings we're talking about, yes. Sometimes it makes sense to keep them in the cluster state. That is a thing that plugins can read.

---

<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:** [April 19, 2017, 3:09pm UTC](https://discuss.elastic.co/t/access-to-client-from-a-script-plugin/79598/5 "2017-04-19T15:09:41Z")

</div>

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