Skip to content

Commit b54940d

Browse files
Add annotations_enabled to model config (#4919) (#4941)
Relates: elastic/elasticsearch#57539 Co-authored-by: Russ Cam <russ.cam@elastic.co>
1 parent ef4d892 commit b54940d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/Nest/XPack/MachineLearning/Job/Config/ModelPlotConfig.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public interface IModelPlotConfig : IModelPlotConfigEnabled
2323
/// </remarks>
2424
[DataMember(Name ="terms")]
2525
Fields Terms { get; set; }
26+
27+
/// <summary>
28+
/// If <c>true</c>, enables calculation and storage of the model change annotations
29+
/// for each entity that is being analyzed. By default, this is not enabled.
30+
/// <para />
31+
/// Valid in Elasticsearch 7.9.0+
32+
/// </summary>
33+
[DataMember(Name = "annotations_enabled")]
34+
bool? AnnotationsEnabled { get; set; }
2635
}
2736

2837
/// <inheritdoc />
@@ -33,23 +42,31 @@ public class ModelPlotConfig : IModelPlotConfig
3342

3443
/// <inheritdoc />
3544
public Fields Terms { get; set; }
45+
46+
/// <inheritdoc />
47+
public bool? AnnotationsEnabled { get; set; }
3648
}
3749

3850
/// <inheritdoc />
3951
public class ModelPlotConfigDescriptor<T> : DescriptorBase<ModelPlotConfigDescriptor<T>, IModelPlotConfig>, IModelPlotConfig where T : class
4052
{
4153
bool? IModelPlotConfigEnabled.Enabled { get; set; }
4254
Fields IModelPlotConfig.Terms { get; set; }
55+
bool? IModelPlotConfig.AnnotationsEnabled { get; set; }
4356

44-
/// <inheritdoc />
57+
/// <inheritdoc cref="IModelPlotConfigEnabled.Enabled" />
4558
public ModelPlotConfigDescriptor<T> Enabled(bool? enabled = true) => Assign(enabled, (a, v) => a.Enabled = v);
4659

47-
/// <inheritdoc />
60+
/// <inheritdoc cref="IModelPlotConfig.Terms" />
4861
public ModelPlotConfigDescriptor<T> Terms(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
4962
Assign(fields, (a, v) => a.Terms = v?.Invoke(new FieldsDescriptor<T>())?.Value);
5063

51-
/// <inheritdoc />
64+
/// <inheritdoc cref="IModelPlotConfig.Terms" />
5265
public ModelPlotConfigDescriptor<T> Terms(Fields fields) => Assign(fields, (a, v) => a.Terms = v);
66+
67+
/// <inheritdoc cref="IModelPlotConfig.AnnotationsEnabled" />
68+
public ModelPlotConfigDescriptor<T> AnnotationsEnabled(bool? enabled = true) =>
69+
Assign(enabled, (a, v) => a.AnnotationsEnabled = v);
5370
}
5471

5572
/// <summary>

0 commit comments

Comments
 (0)