Update anomaly detection job API
editUpdate anomaly detection job API
editProvides the ability to update an anomaly detection job.
It accepts a UpdateJobRequest
object and responds with a PutJobResponse
object.
Update anomaly detection job request
editAn UpdateJobRequest
object gets created with a JobUpdate
object.
Optional arguments
editThe JobUpdate
object has many optional arguments with which to update an
existing anomaly detection job. An existing, non-null jobId
must be referenced in its
creation.
JobUpdate update = new JobUpdate.Builder(jobId) .setDescription("My description") .setAnalysisLimits(new AnalysisLimits(1000L, null)) .setBackgroundPersistInterval(TimeValue.timeValueHours(3)) .setCategorizationFilters(Arrays.asList("categorization-filter")) .setDetectorUpdates(Arrays.asList(detectorUpdate)) .setGroups(Arrays.asList("job-group-1")) .setResultsRetentionDays(10L) .setModelPlotConfig(new ModelPlotConfig(true, null)) .setModelSnapshotRetentionDays(7L) .setCustomSettings(customSettings) .setRenormalizationWindowDays(3L) .build();
Mandatory, non-null |
|
Updated description. |
|
Updated analysis limits. |
|
Updated background persistence interval. |
|
Updated analysis config’s categorization filters. |
|
Updated detectors through the |
|
Updated group membership. |
|
Updated result retention. |
|
Updated model plot configuration. |
|
Updated model snapshot retention setting. |
|
Updated custom settings. |
|
Updated renormalization window. |
Included with these options are specific optional JobUpdate.DetectorUpdate
updates.
Synchronous execution
editWhen executing a UpdateJobRequest
in the following manner, the client waits
for the PutJobResponse
to be returned before continuing with code execution:
PutJobResponse updateJobResponse = client.machineLearning().updateJob(updateJobRequest, RequestOptions.DEFAULT);
Synchronous calls may throw an IOException
in case of either failing to
parse the REST response in the high-level REST client, the request times out
or similar cases where there is no response coming back from the server.
In cases where the server returns a 4xx
or 5xx
error code, the high-level
client tries to parse the response body error details instead and then throws
a generic ElasticsearchException
and adds the original ResponseException
as a
suppressed exception to it.
Asynchronous execution
editExecuting a UpdateJobRequest
can also be done in an asynchronous fashion so that
the client can return directly. Users need to specify how the response or
potential failures will be handled by passing the request and a listener to the
asynchronous update-job method:
The asynchronous method does not block and returns immediately. Once it is
completed the ActionListener
is called back using the onResponse
method
if the execution successfully completed or using the onFailure
method if
it failed. Failure scenarios and expected exceptions are the same as in the
synchronous execution case.
A typical listener for update-job
looks like:
Update anomaly detection job response
editA PutJobResponse
contains the updated Job
object