# Elasticsearch automatic reindex

**URL:** <https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847>\
**Category:** Elasticsearch\
**Created:** [March 4, 2022, 1:51pm UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847 "2022-03-04T13:51:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bianca6](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@bianca6](https://discuss.elastic.co/u/bianca6)\
**Post date:** [March 4, 2022, 1:51pm UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847/1 "2022-03-04T13:51:43Z")

</div>

Hello,

I am using a pipeline with Filebeat / Logstash / Elasticsearch / Kibana version 8 to deal with logs.

One of the field is a nano second timestamp.  
Long story, I can't send it as a 'date\_nanos', so, what I'm doing instead is I send it as a string, and then, Elasticsearch know how to use it as a 'date'.

After that, I create a new index (copy paste the mapping), I change from 'date' to 'date\_nanos' and I reindex what Logstash sent.

This is a really boring manual task incompatible with production, but this is all I can read "just reindex, just reindex, just reindex...".

So, how can I automate this? Is there a way from logstash to choose a mapping from Elasticsearch? Or maybe Elasticsearch can reindex automaticaly?

Thanks for your time and answers.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 5, 2022, 4:34am UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847/2 "2022-03-05T04:34:21Z")

</div>

Why don't you specify an index template with the mapping so it applies for all new indices?

---

<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:** [March 6, 2022, 10:25pm UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847/3 "2022-03-06T22:25:25Z")

</div>

Yep, look at [Index templates | Elasticsearch Guide [8.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/index-templates.html)

---

<div class="post-metadata">

**Author:** ![bianca6](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@bianca6](https://discuss.elastic.co/u/bianca6)\
**Post date:** [March 7, 2022, 8:25am UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847/4 "2022-03-07T08:25:38Z")

</div>

I was not aware of this, well, it seems to suit perfectly, thanks for the information!

---

<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:** [April 4, 2022, 8:26am UTC](https://discuss.elastic.co/t/elasticsearch-automatic-reindex/298847/5 "2022-04-04T08:26:09Z")

</div>

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