Skip to content

Commit a751cdb

Browse files
davidkyleKubik42
authored andcommitted
[ML] Remove legacy Anomaly detection v5.4 logic (elastic#136476)
1 parent 2d41295 commit a751cdb

File tree

4 files changed

+3
-102
lines changed

4 files changed

+3
-102
lines changed

x-pack/plugin/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
125125
task.skipTest("ml/job_cat_apis/Test cat anomaly detector jobs", "Flush API is deprecated")
126126
task.skipTest("ml/jobs_get_stats/Test get job stats after uploading data prompting the creation of some stats", "Flush API is deprecated")
127127
task.skipTest("ml/jobs_get_stats/Test get job stats for closed job", "Flush API is deprecated")
128+
task.skipTest("ml/jobs_get_stats/Test reading v54 data counts and model size stats", "Version 5.4 support removed")
128129
task.skipTest("ml/inference_crud/Test deprecation of include model definition param", "Query parameter removed")
129130
task.skipTest("ml/post_data/Test flush and close job WITHOUT sending any data", "Flush API is deprecated")
130131
task.skipTest("ml/post_data/Test flush with skip_time", "Flush API is deprecated")

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/DataCounts.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ public static String documentId(String jobId) {
138138
return jobId + DOCUMENT_SUFFIX;
139139
}
140140

141-
public static String v54DocumentId(String jobId) {
142-
return jobId + "-data-counts";
143-
}
144-
145141
private final String jobId;
146142
private long processedRecordCount;
147143
private long processedFieldCount;

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProvider.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,7 @@ public void getDataCountsModelSizeAndTimingStats(
526526
.addAggregation(
527527
AggregationBuilders.filters(
528528
results,
529-
new FiltersAggregator.KeyedFilter(
530-
dataCounts,
531-
QueryBuilders.idsQuery().addIds(DataCounts.documentId(jobId), DataCounts.v54DocumentId(jobId))
532-
),
529+
new FiltersAggregator.KeyedFilter(dataCounts, QueryBuilders.idsQuery().addIds(DataCounts.documentId(jobId))),
533530
new FiltersAggregator.KeyedFilter(timingStats, QueryBuilders.idsQuery().addIds(TimingStats.documentId(jobId))),
534531
new FiltersAggregator.KeyedFilter(
535532
modelSizeStats,
@@ -588,7 +585,7 @@ private SearchRequestBuilder createLatestDataCountsSearch(String indexName, Stri
588585
.setSize(1)
589586
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
590587
// look for both old and new formats
591-
.setQuery(QueryBuilders.idsQuery().addIds(DataCounts.documentId(jobId), DataCounts.v54DocumentId(jobId)))
588+
.setQuery(QueryBuilders.idsQuery().addIds(DataCounts.documentId(jobId)))
592589
// We want to sort on log_time. However, this was added a long time later and before that we used to
593590
// sort on latest_record_time. Thus we handle older data counts where no log_time exists and we fall back
594591
// to the prior behaviour.

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/ml/jobs_get_stats.yml

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -245,99 +245,6 @@ setup:
245245
job_id: "missing-*"
246246
allow_no_match: false
247247

248-
---
249-
"Test reading v54 data counts and model size stats":
250-
251-
- do:
252-
ml.put_job:
253-
job_id: job-stats-v54-bwc-test
254-
body: >
255-
{
256-
"analysis_config" : {
257-
"bucket_span": "1h",
258-
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
259-
},
260-
"analysis_limits" : {
261-
"model_memory_limit": "10mb"
262-
},
263-
"data_description" : {
264-
}
265-
}
266-
267-
- do:
268-
headers:
269-
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
270-
indices.refresh:
271-
index: ".ml-anomalies*"
272-
273-
# This is testing that the documents with v5.4 IDs are fetched.
274-
# Ideally we would use the v5.4 type but we can't put a mapping
275-
# for another type into the single type indices. Type isn't used
276-
# in the query so the test is valid
277-
- do:
278-
headers:
279-
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
280-
Content-Type: application/json
281-
index:
282-
index: .ml-anomalies-shared
283-
id: job-stats-v54-bwc-test-data-counts
284-
body:
285-
{
286-
job_id : job-stats-v54-bwc-test,
287-
processed_record_count : 10,
288-
processed_field_count : 0,
289-
input_bytes : 0,
290-
input_field_count : 0,
291-
invalid_date_count : 0,
292-
missing_field_count : 0,
293-
out_of_order_timestamp_count : 0,
294-
empty_bucket_count : 0,
295-
sparse_bucket_count : 0,
296-
bucket_count : 0,
297-
input_record_count : 0,
298-
latest_record_timestamp: 2000000000000
299-
}
300-
301-
- do:
302-
headers:
303-
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
304-
Content-Type: application/json
305-
index:
306-
index: .ml-anomalies-shared
307-
id: job-stats-v54-bwc-test-model_size_stats
308-
body:
309-
{
310-
job_id : job-stats-v54-bwc-test,
311-
result_type : model_size_stats,
312-
model_bytes : 0,
313-
total_by_field_count : 101,
314-
total_over_field_count : 0,
315-
total_partition_field_count : 0,
316-
bucket_allocation_failures_count : 0,
317-
memory_status : ok,
318-
categorized_doc_count : 0,
319-
total_category_count : 0,
320-
frequent_category_count : 0,
321-
rare_category_count : 0,
322-
dead_category_count : 0,
323-
failed_category_count : 0,
324-
categorization_status : ok,
325-
log_time : 1495808248662
326-
}
327-
328-
- do:
329-
headers:
330-
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
331-
indices.refresh:
332-
index: [.ml-anomalies-shared]
333-
334-
- do:
335-
ml.get_job_stats:
336-
job_id: job-stats-v54-bwc-test
337-
- match: { jobs.0.job_id : job-stats-v54-bwc-test }
338-
- match: { jobs.0.data_counts.processed_record_count: 10 }
339-
- match: { jobs.0.model_size_stats.total_by_field_count: 101 }
340-
341248
---
342249
"Test no exception on get job stats with missing index":
343250

0 commit comments

Comments
 (0)