# Performance of 'Update by query' for frequent runs with at most 1 object returned

**URL:** <https://discuss.elastic.co/t/performance-of-update-by-query-for-frequent-runs-with-at-most-1-object-returned/275122>\
**Category:** Elasticsearch\
**Created:** [June 7, 2021, 9:34am UTC](https://discuss.elastic.co/t/performance-of-update-by-query-for-frequent-runs-with-at-most-1-object-returned/275122 "2021-06-07T09:34:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hariso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hariso/32/50668_2.png) [@hariso](https://discuss.elastic.co/u/hariso)\
**Post date:** [June 7, 2021, 9:34am UTC](https://discuss.elastic.co/t/performance-of-update-by-query-for-frequent-runs-with-at-most-1-object-returned/275122/1 "2021-06-07T09:34:35Z")

</div>

How does UBQ perform when it's being run frequently, and where at most one object will be updated? I have a cluster with a significant number of indexes and quite some documents (a few billions in total). In certain processes, an object with certain criteria needs to be updated.

Right now, it's being done in a 'naive' way: a search is performed, if there are any results, a partial doc update is being done.

I'm interested in knowing if an UBQ can replace these two steps with one and can be more efficient.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 7, 2021, 10:06am UTC](https://discuss.elastic.co/t/performance-of-update-by-query-for-frequent-runs-with-at-most-1-object-returned/275122/2 "2021-06-07T10:06:51Z")

</div>

You can probably replace it with UBQ but as it basically does the same work you are doing on the server I do not think it will be a lot more efficient.

---

<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, 2021, 10:07am UTC](https://discuss.elastic.co/t/performance-of-update-by-query-for-frequent-runs-with-at-most-1-object-returned/275122/3 "2021-07-05T10:07:01Z")

</div>

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