Possible to set default refresh_interval for all new indices?

After running into some scaiing problems with our Elasticsearch cluster (running as part of an ELK stack), I read up on refreshes, and in particular, the refresh interval. I set it from 1s to 30s (which should be totally acceptable for our needs), and performance improved dramatically, which was wonderful.

That is, until the day ended and a new set of indices were created, which had the default value of 1s again.

The command I originally issued to set the interval to 30s for all indices:

curl -XPUT hostname:9200/_settings -d '{
  "index": {
    "refresh_interval": "30s"
  }
}'

Is there some different command to have it take effect on a cluster-wide basis? Is this something I can do with index templates? If so, is that the only way to do so?

1 Like

You do that in templates - https://www.elastic.co/guide/en/elasticsearch/reference/2.3/indices-templates.html#indices-templates

2 Likes

Excellent, thank you very much.

For future reference to others viewing, this worked for me:

curl -XPUT hostname:9200:/_template/all_indices -d '
{
  "template": "*",
  "settings": {
    "refresh_interval": "30s"
  }
}
`
4 Likes