WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Update Settings
editUpdate Settings
editThis call allows you to update the index settings.
NEST whitelists which settings can be updated based on the allowed values mentioned
here in the Elasticsearch documentation
this allows you to reuse an IndexSettings
object.
Example
editthis example first creates an index and then uses the same IndexSettings to update the index.
var index = Guid.NewGuid().ToString(); var client = this.ConnectedClient; var settings = new IndexSettings(); settings.NumberOfReplicas = 1; settings.NumberOfShards = 5; settings.Add("refresh_interval", "1s"); settings.Add("search.slowlog.threshold.fetch.warn", "1s"); client.CreateIndex(index, settings); settings["refresh_interval"] = "-1"; settings["search.slowlog.threshold.fetch.warn"] = "5s"; var r = this.ConnectedClient.UpdateSettings(index, settings); Assert.True(r.Success); Assert.True(r.OK); var getResponse = this.ConnectedClient.GetIndexSettings(index); Assert.AreEqual(getResponse.Settings["refresh_interval"], "-1"); Assert.AreEqual(getResponse.Settings["search.slowlog.threshold.fetch.warn"], "1s");