diff --git a/src/Nest/Cluster/NodesStats/NodeStats.cs b/src/Nest/Cluster/NodesStats/NodeStats.cs index 07aaa1c1041..0593937d9ef 100644 --- a/src/Nest/Cluster/NodesStats/NodeStats.cs +++ b/src/Nest/Cluster/NodesStats/NodeStats.cs @@ -66,8 +66,7 @@ public class NodeStats /// Available in Elasticsearch 7.8.0+ /// [DataMember(Name = "script_cache")] - [JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter))] - public IReadOnlyDictionary ScriptCache { get; internal set; } + public ScriptCacheStats ScriptCache { get; internal set; } [DataMember(Name = "thread_pool")] [JsonFormatter(typeof(VerbatimInterfaceReadOnlyDictionaryKeysFormatter))] @@ -83,6 +82,22 @@ public class NodeStats public string TransportAddress { get; internal set; } } + [DataContract] + public class ScriptCacheStats + { + [DataMember(Name = "sum")] + public ScriptStats Sum { get; internal set; } + + [DataMember(Name = "contexts")] + public IReadOnlyCollection Contexts { get; internal set; } + } + + [DataContract] + public class ContextScriptStats : ScriptStats + { + [DataMember(Name = "context")] + public string Context { get; internal set; } + } [DataContract] public class ScriptStats diff --git a/tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs b/tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs index 0b6f1728422..de6ae5b0928 100644 --- a/tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs +++ b/tests/Tests/Cluster/NodesStats/NodesStatsApiTests.cs @@ -189,8 +189,11 @@ protected void Assert(ProcessStats process) protected void Assert(ScriptStats script) => script.Should().NotBeNull(); - protected void Assert(IReadOnlyDictionary scriptCache) => + protected void Assert(ScriptCacheStats scriptCache) + { scriptCache.Should().NotBeNull(); + scriptCache.Sum.Should().NotBeNull(); + } protected void Assert(TransportStats transport) => transport.Should().NotBeNull();