# Merge daily indexes into monthly

**URL:** <https://discuss.elastic.co/t/merge-daily-indexes-into-monthly/220230>\
**Category:** Elasticsearch\
**Created:** [February 20, 2020, 4:48pm UTC](https://discuss.elastic.co/t/merge-daily-indexes-into-monthly/220230 "2020-02-20T16:48:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norman\_Khine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/norman_khine/32/3342_2.png) [@Norman\_Khine](https://discuss.elastic.co/u/Norman_Khine)\
**Post date:** [February 20, 2020, 4:48pm UTC](https://discuss.elastic.co/t/merge-daily-indexes-into-monthly/220230/1 "2020-02-20T16:48:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 19, 2020, 4:48pm UTC](https://discuss.elastic.co/t/merge-daily-indexes-into-monthly/220230/2 "2020-03-19T16:48:29Z")

</div>

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