You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ended up using a workaround just to get the settings I need:
public class PartialSettingsState
{
[JsonPropertyName("settings")]
public PartialSettings Settings { get; set; }
}
public class PartialSettings
{
[JsonPropertyName("index")]
public PartialIndexSettings Index { get; set; }
}
public class PartialIndexSettings
{
[JsonPropertyName("number_of_replicas")]
public int? NumberOfReplicas { get; set; }
[JsonPropertyName("refresh_interval")]
public Duration? RefreshInterval { get; set; }
}
[TestClass]
public class GetSettingsWorkaround
{
[TestMethod]
public async Task GetSettings()
{
var indexName = "test";
var client = TestHelper.GetClient();
var response = await client.Transport.RequestAsync<StringResponse>(HttpMethod.GET,
$"{indexName}/_settings/index.number_of_replicas,index.refresh_interval");
var options = new JsonSerializerOptions()
{
NumberHandling = JsonNumberHandling.AllowReadingFromString
};
IReadOnlyDictionary<IndexName, PartialSettingsState> indices =
JsonSerializer.Deserialize<Dictionary<IndexName, PartialSettingsState>>(response.Body, options);
var settings = indices[indexName].Settings;
}
}
Elastic.Clients.Elasticsearch version: 8.15.6
Elasticsearch version: 8.15.0
.NET runtime version: 4.8
Operating system version: Windows 11
Description of the problem including expected versus actual behavior:
GetIndicesSettingsReponse puts the settings into a protected dictionary but doesn't provide a public method to actually access those settings.
Steps to reproduce:
Expected behavior
I would expect a call to get the settings for an index would return the settings, ideally in a typed IndexSettings object.
The text was updated successfully, but these errors were encountered: