[ML] Improve error for functions with limited rule condition support (#32548)

Closes #32545
This commit is contained in:
Dimitris Athanasiou 2018-08-01 18:15:46 +01:00 committed by GitHub
parent 2985920134
commit c5140170f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -455,7 +455,7 @@ A rule has the following properties:
+
--
NOTE: If your detector uses `lat_long`, `metric`, `rare`, or `freq_rare`
functions, you cannot specify `conditions` for your rule.
functions, you can only specify `conditions` that apply to `time`.
A condition has the following properties:

View File

@ -92,7 +92,7 @@ public final class Messages {
public static final String JOB_CONFIG_CATEGORIZATION_ANALYZER_REQUIRES_CATEGORIZATION_FIELD_NAME =
"categorization_analyzer requires setting categorization_field_name";
public static final String JOB_CONFIG_DETECTION_RULE_NOT_SUPPORTED_BY_FUNCTION =
"Invalid detector rule: function {0} does not support rules with conditions";
"Invalid detector rule: function {0} only supports conditions that apply to time";
public static final String JOB_CONFIG_DETECTION_RULE_REQUIRES_SCOPE_OR_CONDITION =
"Invalid detector rule: at least scope or a condition is required";
public static final String JOB_CONFIG_DETECTION_RULE_SCOPE_HAS_INVALID_FIELD =

View File

@ -541,7 +541,7 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
ElasticsearchException e = ESTestCase.expectThrows(ElasticsearchException.class, detector::build);
assertThat(e.getMessage(), equalTo("Invalid detector rule: function lat_long does not support rules with conditions"));
assertThat(e.getMessage(), equalTo("Invalid detector rule: function lat_long only supports conditions that apply to time"));
}
public void testVerify_GivenRulesAndFunctionIsMetric() {
@ -551,7 +551,7 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
ElasticsearchException e = ESTestCase.expectThrows(ElasticsearchException.class, detector::build);
assertThat(e.getMessage(), equalTo("Invalid detector rule: function metric does not support rules with conditions"));
assertThat(e.getMessage(), equalTo("Invalid detector rule: function metric only supports conditions that apply to time"));
}
public void testVerify_GivenRulesAndFunctionIsRare() {
@ -562,7 +562,7 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
ElasticsearchException e = ESTestCase.expectThrows(ElasticsearchException.class, detector::build);
assertThat(e.getMessage(), equalTo("Invalid detector rule: function rare does not support rules with conditions"));
assertThat(e.getMessage(), equalTo("Invalid detector rule: function rare only supports conditions that apply to time"));
}
public void testVerify_GivenRulesAndFunctionIsFreqRare() {
@ -574,7 +574,7 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
ElasticsearchException e = ESTestCase.expectThrows(ElasticsearchException.class, detector::build);
assertThat(e.getMessage(), equalTo("Invalid detector rule: function freq_rare does not support rules with conditions"));
assertThat(e.getMessage(), equalTo("Invalid detector rule: function freq_rare only supports conditions that apply to time"));
}
public void testVerify_GivenTimeConditionRuleAndFunctionIsLatLong() {