# Elasticsearch: Automatically setting index level settings for daily indexes

**URL:** <https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505>\
**Category:** Elasticsearch\
**Created:** [February 7, 2022, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505 "2022-02-07T17:16:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ege](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ege/32/80438_2.png) [@ege](https://discuss.elastic.co/u/ege)\
**Post date:** [February 7, 2022, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505/1 "2022-02-07T17:16:02Z")

</div>

I need to increase the,

- maximum value of documents retrieved by an Elasticsearch query
- maximum number of script\_fields that are allowed in a query

After refering [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html), I used the [update-index-settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html) API as below, for the above tasks.

- To increase maximum value of documents

```auto
PUT _all/_settings {
"index" : { "max_result_window" : 20000 }
}

```

- To increase maximum value of script\_fields

```auto
PUT _all/_settings {
"index" : { "max_script_fields" : 40 }
}

```

Even though they get applied for all the current indexes, the settings do not get applied to any new index created in Elasticsearch. **I have daily indexes getting created and I would like to know if there's a way to automatically set the above settings for any new index created in Elasticsearch.**

Your kind help would be appreciated. 😊

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 7, 2022, 5:20pm UTC](https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505/2 "2022-02-07T17:20:39Z")

</div>

You need to create a template that will be applied to your index when it is created.

The documentation about index templates is [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html).

---

<div class="post-metadata">

**Author:** ![ege](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ege/32/80438_2.png) [@ege](https://discuss.elastic.co/u/ege)\
**Post date:** [February 7, 2022, 5:35pm UTC](https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505/3 "2022-02-07T17:35:52Z")

</div>

Thank you so much for the quick response @leandrojmp! 😊

I will try it out.

---

<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 7, 2022, 5:36pm UTC](https://discuss.elastic.co/t/elasticsearch-automatically-setting-index-level-settings-for-daily-indexes/296505/4 "2022-03-07T17:36:50Z")

</div>

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