Scheduled cross-cluster _reindex

Hi,

we have various elastic cloud deployments where we would need to copy data from one cluster to another (with filters).
We found that we can do this with POST _reindex

Now to my question:
Is there a way to schedule a task right within elastic to trigger this corss cluster _reindex that gets the data from the last 7 days?
Or should such actions be performed from an outside cronjob that sends this request to elastic?

Example reindex:

POST _reindex
{
  "source": {
    "remote": {
      "host": "https://remotehost",
      "username": "elastic",
      "password": "??"
    },
    "index": "remoteindex*",
    "query": {
      "bool": {
        "filter": [
          {
            "range": {
              "@timestamp": {
                "gte": "2021-01-01T00:00:00.000Z",
                "lte": "2022-07-01T00:00:00.000Z",
                "format": "strict_date_optional_time"
              }
            }
          },
          {
            "match_phrase": {
              "labels.somelabel.keyword": "somevalue"
            }
          },
          {
            "bool": {
              "should": [
                {
                  "match_phrase": {
                    "client.somelabel2.keyword": "somevalue2"
                  }
                },
                {
                  "match_phrase": {
                    "client.somelabel3.keyword": "somevalue3"
                  }
                }
              ],
              "minimum_should_match": 1
            }
          }
        ]
      }
    }  
  },
  "dest": {
    "index": "dstindex"
  }
}

There's not, no. Generally it would be requested from outside Elasticsearch, via a cron'd script as you suggest.

It might be worth raising a feature request for this though.

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