# Can I use \_reindex api to copy more than 10000 documents

**URL:** <https://forum.opensearch.org/t/can-i-use-reindex-api-to-copy-more-than-10000-documents/19021>\
**Category:** OpenSearch\
**Created:** [April 24, 2024, 8:27am UTC](https://forum.opensearch.org/t/can-i-use-reindex-api-to-copy-more-than-10000-documents/19021 "2024-04-24T08:27:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomex](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@Tomex](https://forum.opensearch.org/u/Tomex)\
**Post date:** [April 24, 2024, 8:27am UTC](https://forum.opensearch.org/t/can-i-use-reindex-api-to-copy-more-than-10000-documents/19021/1 "2024-04-24T08:27:24Z")

</div>

OpenSearch 2.11

I plan to use \_reindex API to copy subset of one index to another. I am not interested in specific documents, can by random set.

By making the `_reindex` request with max\_docs and size set over 10000, I get following error.

```auto
"error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Batch size is too large, size must be less than or equal to: [10000] but was [20000]. Scroll batch sizes cost as much memory as result windows so they are controlled by the [index.max_result_window] index level setting."
      }
    ],

```

Is there a way to copy more, but not all?  
The index is very simple, and has three fields, I use `query` to narrow what documents to use:

```auto
"query": {
      "term": {
        "customer_id": 12345
      }
    }

```

I understand the concern and error. But is it possible to make OpenSearch scroll thru query results automagically?

---

<div class="post-metadata">

**Author:** ![Tomex](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@Tomex](https://forum.opensearch.org/u/Tomex)\
**Post date:** [April 24, 2024, 8:55am UTC](https://forum.opensearch.org/t/can-i-use-reindex-api-to-copy-more-than-10000-documents/19021/2 "2024-04-24T08:55:22Z")

</div>

Oh, never mind - probably 🙂  
The problem was of `size` field in my request:

```auto
{
  "max_docs": 10000,
  "conflicts":"proceed",
  "source": {
    "size": 10000,

```

Removing the `size`, but keeping `max_docs` seem to help.
