# Retrieve records and update a field at the same time

**URL:** <https://discuss.elastic.co/t/retrieve-records-and-update-a-field-at-the-same-time/320432>\
**Category:** Elasticsearch\
**Created:** [December 4, 2022, 6:58pm UTC](https://discuss.elastic.co/t/retrieve-records-and-update-a-field-at-the-same-time/320432 "2022-12-04T18:58:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [December 4, 2022, 6:58pm UTC](https://discuss.elastic.co/t/retrieve-records-and-update-a-field-at-the-same-time/320432/1 "2022-12-04T18:58:47Z")

</div>

We did not get a response the first time. Hopefully someone can give us some guidance this time.  
Is there anyway when making a query in Elasticsearch, to update a field (such as say a counter++) in each record that is selected by the query.  
Thanks

---

<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:** [December 4, 2022, 7:12pm UTC](https://discuss.elastic.co/t/retrieve-records-and-update-a-field-at-the-same-time/320432/2 "2022-12-04T19:12:44Z")

</div>

No there is not. You need to first run the query and then perform the update as a separate request.

---

<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:** [January 1, 2023, 7:13pm UTC](https://discuss.elastic.co/t/retrieve-records-and-update-a-field-at-the-same-time/320432/3 "2023-01-01T19:13:23Z")

</div>

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