# Automate re-index process

**URL:** <https://discuss.elastic.co/t/automate-re-index-process/293876>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [January 10, 2022, 10:27am UTC](https://discuss.elastic.co/t/automate-re-index-process/293876 "2022-01-10T10:27:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [January 10, 2022, 10:27am UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/1 "2022-01-10T10:27:19Z")

</div>

We are using:

elastic operator 1.8  
Elasticsearch 7.15.2

Current problem: we have 2 shards for every index and 7 data/masters nodes on Elasticsearch (impossible to scale it by license number), we need to retain 6 days the index data and this limit increase the number of index over 3000 (over 6000 shards), that produce that every data node store up to 800 shards.

Our index stores as: solution\_service\_date, and is not possible to change it. To reduce index number, we think that reindex solution could be a good solution (we have a lot of solution index with -1mb), but the reindex api seem like is no possible to automate it.

We try some solutions, like [elasticsearsh reindex tool](https://github.com/garbin/elasticsearch-reindex).

There're some solution to automate reindex to index up to +3 days by index "some\_name"?

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 10, 2022, 9:59pm UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/2 "2022-01-10T21:59:03Z")

</div>

There's nothing native to the stack that can currently do that for you, no.

It should be pretty simple to script though.

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [January 11, 2022, 7:35am UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/3 "2022-01-11T07:35:07Z")

</div>

Thanks! You know some way to run this script into k8s deploy?

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [February 3, 2022, 9:19am UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/4 "2022-02-03T09:19:04Z")

</div>

Hi again, we try to make an script to do this and when try to reindex a big index into a new index, the curl to reindex stop at 60 seg of execution:

```auto
    reindex=$(curl -X POST "https://$ES_HOST:9200/_reindex" -u user:pass -H 'Content-Type: application/json' -d'
    {
      "source": {
        "index": "'$index'"
      },
      "dest": {
        "index": "'$destination'"
      }
    }
    ')

```

The output:

```auto
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 169 0 0 100 169 0 2 0:01:24 0:01:00 0:00:24 0
curl: (52) Empty reply from server

```

When the reindex operation can complete before 60 seg, the process continue correcly.

Try to use "?wait\_for\_completion=true" in the reindex petition but the problem persist. Some idea? if we not verify if the reindex was finished is no possible to continue and delete older index...

Thanks!

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [February 4, 2022, 8:20am UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/5 "2022-02-04T08:20:05Z")

</div>

More tests, now firing similar reindex from kibana dev tools console:

```auto
POST /_reindex
    {
      "source": {
        "index": "metricbeat-origen"
      },
      "dest": {
        "index": "metricbeat-dest"
      }
    }

```

Timeout:

> Failed to connect to Console's backend.  
> Please check the Kibana server is up and running

And console timeout at 60s:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/5/45916c4213a4dbf33ea981e526742df852251416.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/3/833551a96864b146facde47616d32b7a55d59752.png)

---

<div class="post-metadata">

**Author:** ![gerardgorrion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerardgorrion/32/85495_2.png) [@gerardgorrion](https://discuss.elastic.co/u/gerardgorrion)\
**Post date:** [March 2, 2022, 3:46pm UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/6 "2022-03-02T15:46:26Z")

</div>

Hi, someone know how to upgrade the Elasticsearch timeout to wait the response from reindex? thanks

---

<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 30, 2022, 3:47pm UTC](https://discuss.elastic.co/t/automate-re-index-process/293876/7 "2022-03-30T15:47:00Z")

</div>

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