Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ public Builder(DatafeedUpdate config) {
this.delayedDataCheckConfig = config.delayedDataCheckConfig;
}

@Deprecated
public Builder setJobId(String jobId) {
this.jobId = jobId;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ public void testUpdateDatafeed_UpdatingJobIdIsDeprecated() throws Exception {
DatafeedConfig datafeedConfig = DatafeedConfig.builder(datafeedId, jobId).setIndices("some_data_index").build();
execute(new PutDatafeedRequest(datafeedConfig), machineLearningClient::putDatafeed, machineLearningClient::putDatafeedAsync);

DatafeedUpdate datafeedUpdateWithUnchangedJobId = DatafeedUpdate.builder(datafeedId).setJobId(jobId).build();
execute(new UpdateDatafeedRequest(datafeedUpdateWithUnchangedJobId),
machineLearningClient::updateDatafeed,
machineLearningClient::updateDatafeedAsync);

DatafeedUpdate datafeedUpdateWithChangedJobId = DatafeedUpdate.builder(datafeedId).setJobId(anotherJobId).build();
WarningFailureException exception = expectThrows(
WarningFailureException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ private DatafeedUpdate(String id, String jobId, TimeValue queryDelay, TimeValue
this.scrollSize = scrollSize;
this.chunkingConfig = chunkingConfig;
this.delayedDataCheckConfig = delayedDataCheckConfig;
if (jobId != null) {
deprecationLogger.deprecated(DEPRECATION_MESSAGE_ON_JOB_ID_UPDATE);
}
}

public DatafeedUpdate(StreamInput in) throws IOException {
Expand Down Expand Up @@ -304,6 +301,9 @@ public DatafeedConfig apply(DatafeedConfig datafeedConfig, Map<String, String> h

DatafeedConfig.Builder builder = new DatafeedConfig.Builder(datafeedConfig);
if (jobId != null) {
if (datafeedConfig.getJobId() != null && datafeedConfig.getJobId().equals(jobId) == false) {
deprecationLogger.deprecated(DEPRECATION_MESSAGE_ON_JOB_ID_UPDATE);
}
builder.setJobId(jobId);
}
if (queryDelay != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,16 @@ setup:
"indexes":["index-foo"],
"scroll_size": 2000
}
- match: { job_id: "datafeeds-crud-1" }

- do:
ml.update_datafeed:
datafeed_id: test-datafeed-1
body: >
{
"job_id": "datafeeds-crud-1"
}
- match: { job_id: "datafeeds-crud-1" }

- do:
warnings:
Expand Down