How to set refresh_interval globally in runing elastic search cluster

Hi Team

Kindly help me to configure refresh_interval settings globally in running elastic search cluster

Kindly go through the below command, Which I used to setup refresh_interval

curl -X PUT -k -u elastic:xxxxxx "https://localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d '
{
"index": {
"refresh_interval": "30s"
}
}'

Error

{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: no settings to update;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: no settings to update;"},"status":400}

Kindly help me. Thanks in advance

Try remove '_cluster' in url:

curl -X PUT -k -u elastic:xxxxxx "https://localhost:9200/_settings" -H 'Content-Type: application/json' -d '
{
"index": {
"refresh_interval": "30s"
}
}'

1 Like

Hi

Thank you very much, It's working.

Hi

I have set refresh interval to 30s, after that i have plan to change the value to 20s
But i got below error. Could you please help to solve this

curl -X PUT -k -u elastic:xxxxx "https://localhost:9200/settings" -H 'Content-Type: application/json' -d '
{
"index": {
"refresh_interval": "60s"
}
}'
{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [settings/avEUrBsTTPGhbNVo97Ghhw] already exists","index_uuid":"avEUrBsTTPGhbNVo97Ghhw","index":"settings"}],"type":"resource_already_exists_exception","reason":"index [settings/avEUrBsTTPGhbNVo97Ghhw] already exists","index_uuid":"avEUrBsTTPGhbNVo97Ghhw","index":"settings"},"status":400}

Sorry, it's "_settings" not "setting" in url. if omit underline prefix, it will be thought an index. And you actually indexed a document into index named setting.

So below command will set refresh_interval : 30s

curl -X PUT -k -u elastic:xxxxxxx " https://locahost:9200/_settings" -H 'Content-Type: application/json' -d '
{
"index": {
"refresh_interval": "30s"
}
}'

Was this command set refresh_interval to 30s already using indexes?

yes.

I mean , How to set refresh interval existing indices and also future indices?
I have huge indices, So below may I know below command is usfull to set refresh_interval already running indices?

curl -X PUT -k -u elastic:xxxxxxx " https://locahost:9200/_settings" -H 'Content-Type: application/json' -d '
{
"index": {
"refresh_interval": "30s"
}
}'

You can do that for all future indices with template:

curl -XPUT https://locahost:9200/_template/all_indices -d '

{
  "template": "*",
  "settings": {
    "refresh_interval": "30s"
  }
}'

Okay Thank you

Hi

One more help,

Is there any issue or impact, if we set this refresh interval on running cluster?