Merge daily indexes into monthly

Hello,
Currently we have daily indexes, so I am looking to run a monthly job task to merge these, for example:

POST _reindex?requests_per_second=115&wait_for_completion=true
{
  "source": {
    "index": "analytics-staging-2020.01.*",
    "size": 500
  },
  "dest": {
    "index": "analytics-staging-2020.01"
  },
  "script": {
    "lang": "painless",   
    "source": """
      ctx._source.index = ctx._index;
      def eventData = ctx._source["event.data"];
      if (eventData != null) {
        eventData.remove("realmDb.size");
        eventData.remove("realmDb.format");
        eventData.remove("realmDb.contents");
      }
    """
  }
} 

and then I would delete all the daily indexes.

is this the right way to do this maintenance task?

is it advisable to disable the replica on these daily indexes before performing the merge?

any advice is much appreciated

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