# Update by query performance question

**URL:** <https://discuss.elastic.co/t/update-by-query-performance-question/242042>\
**Category:** Elasticsearch\
**Created:** [July 21, 2020, 2:18pm UTC](https://discuss.elastic.co/t/update-by-query-performance-question/242042 "2020-07-21T14:18:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciocan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ciocan/32/72519_2.png) [@ciocan](https://discuss.elastic.co/u/ciocan)\
**Post date:** [July 21, 2020, 2:18pm UTC](https://discuss.elastic.co/t/update-by-query-performance-question/242042/1 "2020-07-21T14:18:25Z")

</div>

Hi, I'm quite new to elastic search. My problem is the following:

There are two indexes:

- index1 - around 18m docs (~40gb of data)
- index2 - around 22k docs (10mb of data)

I need to update all documents from index1 with values from index2  
(they are related by id's and one document from index2 belongs to multiple documents in index1)

I have tried to search scroll each document from index2 and use updateByQuery to match all documents from index1. It takes ages to complete.

What is a better solution for this?

The elasticsearch is running on a i9 / 6 core / 32gb ram machine

---

<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:** [August 18, 2020, 2:18pm UTC](https://discuss.elastic.co/t/update-by-query-performance-question/242042/2 "2020-08-18T14:18:26Z")

</div>

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