Skip to content

Commit 41959c3

Browse files
Add assigned node to OpenJob/StartDatafeed response (#4815) (#4827)
Relates: elastic/elasticsearch#55473, #4803 Co-authored-by: Russ Cam <russ.cam@elastic.co>
1 parent 91f9ada commit 41959c3

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,13 @@ public class OpenJobResponse : ResponseBase
1010
{
1111
[DataMember(Name ="opened")]
1212
public bool Opened { get; internal set; }
13+
14+
/// <summary>
15+
/// The node that the job was assigned to
16+
/// <para />
17+
/// Available in Elasticsearch 7.8.0+
18+
/// </summary>
19+
[DataMember(Name = "node")]
20+
public string Node { get; internal set; }
1321
}
1422
}

src/Nest/XPack/MachineLearning/StartDatafeed/StartDatafeedResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,13 @@ public class StartDatafeedResponse : ResponseBase
1010
{
1111
[DataMember(Name ="started")]
1212
public bool Started { get; internal set; }
13+
14+
/// <summary>
15+
/// The node that the job was assigned to
16+
/// <para />
17+
/// Available in Elasticsearch 7.8.0+
18+
/// </summary>
19+
[DataMember(Name = "node")]
20+
public string Node { get; internal set; }
1321
}
1422
}

tests/Tests/XPack/MachineLearning/OpenJob/OpenJobApiTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using Elasticsearch.Net;
77
using FluentAssertions;
88
using Nest;
9+
using Tests.Core.Client;
10+
using Tests.Core.Extensions;
911
using Tests.Framework.EndpointTests.TestState;
1012

1113
namespace Tests.XPack.MachineLearning.OpenJob
@@ -45,6 +47,12 @@ protected override LazyResponses ClientUsage() => Calls(
4547

4648
protected override OpenJobDescriptor NewDescriptor() => new OpenJobDescriptor(CallIsolatedValue);
4749

48-
protected override void ExpectResponse(OpenJobResponse response) => response.Opened.Should().BeTrue();
50+
protected override void ExpectResponse(OpenJobResponse response)
51+
{
52+
response.Opened.Should().BeTrue();
53+
54+
if (TestClient.Configuration.InRange(">=7.8.0"))
55+
response.Node.Should().NotBeNullOrEmpty();
56+
}
4957
}
5058
}

tests/Tests/XPack/MachineLearning/StartDatafeed/StartDatafeedApiTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System;
5+
using System;
66
using Elasticsearch.Net;
77
using FluentAssertions;
88
using Nest;
9+
using Tests.Core.Client;
10+
using Tests.Core.Extensions;
911
using Tests.Framework.EndpointTests.TestState;
1012

1113
namespace Tests.XPack.MachineLearning.StartDatafeed
@@ -51,6 +53,12 @@ protected override LazyResponses ClientUsage() => Calls(
5153

5254
protected override StartDatafeedDescriptor NewDescriptor() => new StartDatafeedDescriptor(CallIsolatedValue + "-datafeed");
5355

54-
protected override void ExpectResponse(StartDatafeedResponse response) => response.Started.Should().BeTrue();
56+
protected override void ExpectResponse(StartDatafeedResponse response)
57+
{
58+
response.Started.Should().BeTrue();
59+
60+
if (TestClient.Configuration.InRange(">=7.8.0"))
61+
response.Node.Should().NotBeNullOrEmpty();
62+
}
5563
}
5664
}

0 commit comments

Comments
 (0)