# Server side iterators

**URL:** <https://discuss.elastic.co/t/server-side-iterators/166592>\
**Category:** Elasticsearch\
**Created:** [January 31, 2019, 3:23pm UTC](https://discuss.elastic.co/t/server-side-iterators/166592 "2019-01-31T15:23:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![philv](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@philv](https://discuss.elastic.co/u/philv)\
**Post date:** [January 31, 2019, 3:23pm UTC](https://discuss.elastic.co/t/server-side-iterators/166592/1 "2019-01-31T15:23:56Z")

</div>

I'd like to have a series of mutators that iterate over an index and mutates it, (inserts new fields to the documents , or inserts new documents). Right now we have these pieces of functionality as standalone apps that just call es and scroll over the results of the query they issue, then issue write commands. I was wondering whether it would be more efficient though to run this logic on the es nodes themselves, a bit like something like accumulo does with it's server side iterators. I saw that you can route to local nodes  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html)

My next thought was whether I could do all this in an es plugin. (ie. iterate and mutate etc , but from the plugin)

I am curious to know what the best practice for this sort of large scale index mutation is ?

Best wishes,  
Phil

---

<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:** [February 28, 2019, 3:23pm UTC](https://discuss.elastic.co/t/server-side-iterators/166592/2 "2019-02-28T15:23:57Z")

</div>

Closed on February 28, 2019, 3:23pm UTC

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