-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Datafeed deprecation checks (#37932)
Deprecation checks for the ML datafeed query and aggregations.
- Loading branch information
1 parent
313fef6
commit 58a76c2
Showing
8 changed files
with
237 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...in/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/MlDeprecationChecks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.deprecation; | ||
|
||
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; | ||
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Check the {@link DatafeedConfig} query and aggregations for deprecated usages. | ||
*/ | ||
final class MlDeprecationChecks { | ||
|
||
private MlDeprecationChecks() { | ||
} | ||
|
||
static DeprecationIssue checkDataFeedQuery(DatafeedConfig datafeedConfig) { | ||
List<String> deprecations = datafeedConfig.getQueryDeprecations(); | ||
if (deprecations.isEmpty()) { | ||
return null; | ||
} else { | ||
return new DeprecationIssue(DeprecationIssue.Level.WARNING, | ||
"Datafeed [" + datafeedConfig.getId() + "] uses deprecated query options", | ||
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html#breaking_70_search_changes", | ||
deprecations.toString()); | ||
} | ||
} | ||
|
||
static DeprecationIssue checkDataFeedAggregations(DatafeedConfig datafeedConfig) { | ||
List<String> deprecations = datafeedConfig.getAggDeprecations(); | ||
if (deprecations.isEmpty()) { | ||
return null; | ||
} else { | ||
return new DeprecationIssue(DeprecationIssue.Level.WARNING, | ||
"Datafeed [" + datafeedConfig.getId() + "] uses deprecated aggregation options", | ||
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html" + | ||
"#breaking_70_aggregations_changes", deprecations.toString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.