Skip to content

Add option to stop machine learning datafeed that finds no data. #4286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Nest/XPack/MachineLearning/Datafeed/DatafeedConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,13 @@ public class DatafeedConfig
[DataMember(Name = "scroll_size")]
public int? ScrollSize { get; internal set; }

/// <summary>
/// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop
/// itself and close its associated job after this many real-time searches that return no documents. In other words, it will
/// stop after <see cref="Frequency"/> times <see cref="MaximumEmptySearches"/> of real-time operation. If not set then a datafeed
/// with no end time that sees no data will remain started until it is explicitly stopped.
/// </summary>
[DataMember(Name ="max_empty_searches")]
public int? MaximumEmptySearches { get; set; }
}
}
17 changes: 17 additions & 0 deletions src/Nest/XPack/MachineLearning/PutDatafeed/PutDatafeedRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ public partial interface IPutDatafeedRequest
/// </summary>
[DataMember(Name ="scroll_size")]
int? ScrollSize { get; set; }

/// <summary>
/// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop
/// itself and close its associated job after this many real-time searches that return no documents. In other words, it will
/// stop after <see cref="Frequency"/> times <see cref="MaximumEmptySearches"/> of real-time operation. If not set then a datafeed
/// with no end time that sees no data will remain started until it is explicitly stopped.
/// <para/>
/// By default this setting is not set.
/// </summary>
[DataMember(Name ="max_empty_searches")]
int? MaximumEmptySearches { get; set; }
}

/// <inheritdoc />
Expand Down Expand Up @@ -101,6 +112,8 @@ public partial class PutDatafeedRequest
/// <inheritdoc />
public int? ScrollSize { get; set; }

/// <inheritdoc />
public int? MaximumEmptySearches { get; set; }
}

public partial class PutDatafeedDescriptor<TDocument> where TDocument : class
Expand All @@ -114,6 +127,7 @@ public partial class PutDatafeedDescriptor<TDocument> where TDocument : class
Time IPutDatafeedRequest.QueryDelay { get; set; }
IScriptFields IPutDatafeedRequest.ScriptFields { get; set; }
int? IPutDatafeedRequest.ScrollSize { get; set; }
int? IPutDatafeedRequest.MaximumEmptySearches { get; set; }

/// <inheritdoc />
public PutDatafeedDescriptor<TDocument> Aggregations(Func<AggregationContainerDescriptor<TDocument>, IAggregationContainer> aggregationsSelector) =>
Expand Down Expand Up @@ -152,5 +166,8 @@ public PutDatafeedDescriptor<TDocument> ScriptFields(Func<ScriptFieldsDescriptor
/// <inheritdoc />
public PutDatafeedDescriptor<TDocument> ScrollSize(int? scrollSize) => Assign(scrollSize, (a, v) => a.ScrollSize = v);

/// <inheritdoc />
public PutDatafeedDescriptor<TDocument> MaximumEmptySearches(int? maximumEmptySearches) =>
Assign(maximumEmptySearches, (a, v) => a.MaximumEmptySearches = v);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,13 @@ public class PutDatafeedResponse : ResponseBase
[DataMember(Name = "scroll_size")]
public int? ScrollSize { get; internal set; }

/// <summary>
/// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop
/// itself and close its associated job after this many real-time searches that return no documents. In other words, it will
/// stop after <see cref="Frequency"/> times <see cref="MaximumEmptySearches"/> of real-time operation. If not set then a datafeed
/// with no end time that sees no data will remain started until it is explicitly stopped.
/// </summary>
[DataMember(Name ="max_empty_searches")]
public int? MaximumEmptySearches { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public partial interface IUpdateDatafeedRequest
/// </summary>
[DataMember(Name ="scroll_size")]
int? ScrollSize { get; set; }

/// <summary>
/// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop
/// itself and close its associated job after this many real-time searches that return no documents. In other words, it will
/// stop after <see cref="Frequency"/> times <see cref="MaximumEmptySearches"/> of real-time operation. If not set then a datafeed
/// with no end time that sees no data will remain started until it is explicitly stopped.
/// <para/>
/// The special value `-1` unsets this setting.
/// </summary>
[DataMember(Name ="max_empty_searches")]
int? MaximumEmptySearches { get; set; }
}

/// <inheritdoc />
Expand Down Expand Up @@ -100,6 +111,9 @@ public partial class UpdateDatafeedRequest

/// <inheritdoc />
public int? ScrollSize { get; set; }

/// <inheritdoc />
public int? MaximumEmptySearches { get; set; }
}

public partial class UpdateDatafeedDescriptor<TDocument> where TDocument : class
Expand All @@ -113,6 +127,7 @@ public partial class UpdateDatafeedDescriptor<TDocument> where TDocument : class
Time IUpdateDatafeedRequest.QueryDelay { get; set; }
IScriptFields IUpdateDatafeedRequest.ScriptFields { get; set; }
int? IUpdateDatafeedRequest.ScrollSize { get; set; }
int? IUpdateDatafeedRequest.MaximumEmptySearches { get; set; }

/// <inheritdoc />
public UpdateDatafeedDescriptor<TDocument> Aggregations(Func<AggregationContainerDescriptor<TDocument>, IAggregationContainer> aggregationsSelector) =>
Expand Down Expand Up @@ -151,5 +166,9 @@ public UpdateDatafeedDescriptor<TDocument> ScriptFields(Func<ScriptFieldsDescrip

/// <inheritdoc />
public UpdateDatafeedDescriptor<TDocument> ScrollSize(int? scrollSize) => Assign(scrollSize, (a, v) => a.ScrollSize = v);

/// <inheritdoc />
public UpdateDatafeedDescriptor<TDocument> MaximumEmptySearches(int? maximumEmptySearches) =>
Assign(maximumEmptySearches, (a, v) => a.MaximumEmptySearches = v);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public class UpdateDatafeedResponse : ResponseBase
/// </summary>
[DataMember(Name = "scroll_size")]
public int? ScrollSize { get; internal set; }
}

/// <summary>
/// If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop
/// itself and close its associated job after this many real-time searches that return no documents. In other words, it will
/// stop after <see cref="Frequency"/> times <see cref="MaximumEmptySearches"/> of real-time operation. If not set then a datafeed
/// with no end time that sees no data will remain started until it is explicitly stopped.
/// </summary>
[DataMember(Name ="max_empty_searches")]
public int? MaximumEmptySearches { get; set; }
}
}