Elasticsearch: Automatically setting index level settings for daily indexes

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, I used the update-index-settings API as below, for the above tasks.

  • To increase maximum value of documents
PUT _all/_settings {
"index" : { "max_result_window" : 20000 }
}
  • To increase maximum value of script_fields
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. :blush:

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

The documentation about index templates is here.

1 Like

Thank you so much for the quick response @leandrojmp! :blush:

I will try it out.

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