Converting large fields during reindex ends with 429

I'm trying to reindex a complex document into a simple one and I have troubles with embedded fields.

I have a document like this:

POST from/_doc/1
{
  "systemMetadata" : {
    "a:b:c:searchContentHTML" : {
      "textValue" : "This is a very long text 43MB...."
    }
  }
}

And I'm trying to reindex it to something like:

{
  "textValue" : "This is a very long text 43MB...."
}

I have no luck. Can you pls help?

POST _reindex
{
  "source": {
    "index": "from",
    "_source": ["systemMetadata.a:b:c:searchContentHTML"]
  },
  "dest": {
    "index": "htmlcontent"
  },
  "script": {
    "source": "ctx._source.textValue = ctx._source.systemMetadata['a:b:c:searchContentHTML'].textValue;"
  }
}

It works fine for small document, but when the textValue is huge (43MB) I'm getting 429 error

{
  "error" : {
    "root_cause" : [
      {
        "type" : "es_rejected_execution_exception",
        "reason" : "rejected execution of coordinating operation [coordinating_and_primary_bytes=0, replica_bytes=0, all_bytes=0, coordinating_operation_bytes=117199244, max_coordinating_and_primary_bytes=107374182]"
      }
    ],
    "type" : "es_rejected_execution_exception",
    "reason" : "rejected execution of coordinating operation [coordinating_and_primary_bytes=0, replica_bytes=0, all_bytes=0, coordinating_operation_bytes=117199244, max_coordinating_and_primary_bytes=107374182]"
  },
  "status" : 429
}

Can you please advice what is the reason of this error and what is correct solution?
When using this query it works without error, but the textValue is null and the orifinal field is not removed

POST _reindex
{
  "source": {
    "index": "from",
    "_source": ["systemMetadata.a:b:c:searchContentHTML"]
  },
  "dest": {
    "index": "htmlcontent"
  },
  "script": {
    "source": "ctx._source.textValue = ctx._source.remove('systemMetadata.a:b:c:searchContentHTML.textValue')"
  }
}

The error is saying that you are overloading your cluster, likely due to the size of those fields.

You might want to look at Reindex API | Elasticsearch Guide [8.4] | Elastic to reduce the size of each reindex request into something that the nodes can handle.

1 Like

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