Removing persistent cluster settings

Hi All,

I applied the following in my test environment through Dev tools:

PUT /_cluster/settings
    {
      "persistent": {
        "xpack.notification.email.account.exchange_account": {
            "profile": "outlook",
            "email_defaults": {
              "from": "hello.world@abc.com"
            },
            "smtp": {
                "auth": false,
                "starttls.enable": false,
                "host": "abc.def.net",
                "port": 25
            }
        }
      }
    }

I need to remove these settings now.

Please guide on how this could be done.

My entire cluster settings are as follows:

{
  "persistent": {
    "cluster": {
      "max_shards_per_node": "5000"
    },
    "search": {
      "max_async_search_response_size": "50mb"
    },
    "xpack": {
      "monitoring": {
        "collection": {
          "enabled": "true"
        }
      },
            "notification": {
        "email": {
          "account": {
            "exchange_account": {
              "email_defaults": {
                "from": "hello.world@abc.com"
              },
              "profile": "outlook",
              "smtp": {
                "host": "abc.def.net",
                "starttls": {
                  "enable": "false"
                },
                "auth": "false",
                "port": "25"
              }
            }
          }
        }
      }
    }
  },
  "transient": {}

Thanks

Just set the setting as null as shown in the example in the documentation

In this case it would be something like this:

PUT /_cluster/settings
{
  "persistent": {
    "xpack.notification.email.account.exchange_account": null
  }
}

Thanks. I get the following:

#! [xpack.monitoring.collection.enabled] setting was deprecated in Elasticsearch and will be removed in a future release.
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "persistent setting [xpack.notification.email.account.exchange_account], not recognized"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "persistent setting [xpack.notification.email.account.exchange_account], not recognized"
  },
  "status": 400
}

Yeah, not sure.

Maybe you need to set it on the parent level, xpack.notification.email.account.

You either need to set each individual setting to null like this:

PUT /_cluster/settings
{
  "persistent": {
    "xpack": {
      "monitoring": {
        "collection": {
          "enabled": null
        }
      },
      "notification": {
        "email": {
          "account": {
            "exchange_account": {
              "email_defaults": {
                "from": null
              },
              "profile": null,
              "smtp": {
                "host": null,
                "starttls": {
                  "enable": null
                },
                "auth": null,
                "port": null
              }
            }
          }
        }
      }
    }
  }
}

Or else you can use wildcards:

PUT /_cluster/settings
{
  "persistent": {
    "xpack.notification.email.account.exchange_account.*": null
  }
}
1 Like

Thanks! That worked.