Search code examples
elasticsearchreindex

Reindexing more than 10k documents in Elasticsearch


Let's say I have an index- A. It contains 26k documents. Now I want to change a field status with type as Keyword. As I can't change A's status field type which is already existing, I will create a new index: B with my setting my desired type. I followed reindex API:

POST _reindex
{
  "source": {
    "index": "A",
    "size": 10000
  },
  "dest": {
    "index": "B",
    "version_type": "external"
  }
}.

But the problem is, here I can migrate only 10k docs. How to copy the rest?
How can I copy all the docs without losing any?


Solution

  • delete the size: 10000 and problem will be solved.

    by the way the size field in Reindex API means that what batch size elasticsearch should use to fetch and reindex docs every time. by default the batch size is 100. (you thought it means how many document you want to reindex)