From 96cfbc8f4c23a09471fa3ab851d5061f0c95c450 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Wed, 19 Apr 2017 14:07:51 +0100 Subject: [PATCH] [ML] Remove partition_field param from GetBucketsAction (elastic/x-pack-elasticsearch#1122) Relates elastic/x-pack-elasticsearch#1119 Original commit: elastic/x-pack-elasticsearch@c87fdbc03155d3c5440dd20fd4a8c08314c1f1d3 --- docs/en/rest-api/ml/get-bucket.asciidoc | 4 --- docs/en/rest-api/ml/get-record.asciidoc | 4 --- .../xpack/ml/action/GetBucketsAction.java | 30 ++----------------- .../xpack/ml/action/GetRecordsAction.java | 22 ++------------ .../ml/rest/results/RestGetBucketsAction.java | 3 -- .../ml/rest/results/RestGetRecordsAction.java | 4 --- .../action/GetBucketActionRequestTests.java | 6 ---- .../action/GetRecordsActionRequestTests.java | 3 -- .../api/xpack.ml.get_buckets.json | 4 --- .../api/xpack.ml.get_records.json | 4 --- 10 files changed, 4 insertions(+), 80 deletions(-) diff --git a/docs/en/rest-api/ml/get-bucket.asciidoc b/docs/en/rest-api/ml/get-bucket.asciidoc index 026f79c2cea..01dd5fe9b85 100644 --- a/docs/en/rest-api/ml/get-bucket.asciidoc +++ b/docs/en/rest-api/ml/get-bucket.asciidoc @@ -45,10 +45,6 @@ privileges to use this API. For more information, see < `include_interim`:: (boolean) If true, the output includes interim results. -`partition_value`:: - (string) If `expand` is true, the anomaly records are filtered by this - partition value. - `size`:: (integer) Specifies the maximum number of buckets to obtain. diff --git a/docs/en/rest-api/ml/get-record.asciidoc b/docs/en/rest-api/ml/get-record.asciidoc index e197ed9cc56..a99f60c1ca4 100644 --- a/docs/en/rest-api/ml/get-record.asciidoc +++ b/docs/en/rest-api/ml/get-record.asciidoc @@ -37,10 +37,6 @@ privileges to use this API. For more information, see < `include_interim`:: (boolean) If true, the output includes interim results. -`partition_value`:: - (string) If `expand` is true, the records are filtered by this - partition value. - `record_score`:: (double) Returns records with anomaly scores higher than this value. diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java index e60e99d299b..399f324ca4c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/GetBucketsAction.java @@ -65,7 +65,6 @@ public class GetBucketsAction extends Action request.jobId = jobId, Job.ID); PARSER.declareString(Request::setTimestamp, Result.TIMESTAMP); - PARSER.declareString(Request::setPartitionValue, PARTITION_VALUE); PARSER.declareBoolean(Request::setExpand, EXPAND); PARSER.declareBoolean(Request::setIncludeInterim, INCLUDE_INTERIM); PARSER.declareStringOrNull(Request::setStart, START); PARSER.declareStringOrNull(Request::setEnd, END); - PARSER.declareBoolean(Request::setExpand, EXPAND); - PARSER.declareBoolean(Request::setIncludeInterim, INCLUDE_INTERIM); PARSER.declareObject(Request::setPageParams, PageParams.PARSER, PageParams.PAGE); PARSER.declareDouble(Request::setAnomalyScore, ANOMALY_SCORE); - PARSER.declareString(Request::setPartitionValue, PARTITION_VALUE); } public static Request parseRequest(String jobId, XContentParser parser) { @@ -100,7 +95,6 @@ public class GetBucketsAction extends Action PARSER = new ObjectParser<>(NAME, Request::new); @@ -77,7 +76,6 @@ public class GetRecordsAction extends Action request.jobId = jobId, Job.ID); PARSER.declareStringOrNull(Request::setStart, START); PARSER.declareStringOrNull(Request::setEnd, END); - PARSER.declareString(Request::setPartitionValue, PARTITION_VALUE); PARSER.declareString(Request::setSort, SORT); PARSER.declareBoolean(Request::setDecending, DESCENDING); PARSER.declareBoolean(Request::setIncludeInterim, INCLUDE_INTERIM); @@ -101,7 +99,6 @@ public class GetRecordsAction extends Action client.execute(GetRecordsAction.INSTANCE, request, new RestToXContentListener<>(channel)); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java index d9bc4e2a4c6..9d3ca7eba08 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetBucketActionRequestTests.java @@ -19,9 +19,6 @@ public class GetBucketActionRequestTests extends AbstractStreamableXContentTestC if (randomBoolean()) { request.setTimestamp(String.valueOf(randomLong())); } else { - if (randomBoolean()) { - request.setPartitionValue(randomAlphaOfLengthBetween(1, 20)); - } if (randomBoolean()) { request.setStart(String.valueOf(randomLong())); } @@ -34,9 +31,6 @@ public class GetBucketActionRequestTests extends AbstractStreamableXContentTestC if (randomBoolean()) { request.setAnomalyScore(randomDouble()); } - if (randomBoolean()) { - request.setPartitionValue(randomAlphaOfLengthBetween(1, 20)); - } if (randomBoolean()) { int from = randomInt(PageParams.MAX_FROM_SIZE_SUM); int maxSize = PageParams.MAX_FROM_SIZE_SUM - from; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java index 76f712cb835..775797ede23 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/action/GetRecordsActionRequestTests.java @@ -28,9 +28,6 @@ public class GetRecordsActionRequestTests extends AbstractStreamableXContentTest String end = randomBoolean() ? randomAlphaOfLengthBetween(1, 20) : String.valueOf(randomNonNegativeLong()); request.setEnd(end); } - if (randomBoolean()) { - request.setPartitionValue(randomAlphaOfLengthBetween(1, 20)); - } if (randomBoolean()) { request.setSort(randomAlphaOfLengthBetween(1, 20)); } diff --git a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json index 496103831b0..606d078e485 100644 --- a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json +++ b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json @@ -27,10 +27,6 @@ "type": "boolean", "description" : "Include interim results" }, - "partition_value": { - "type": "string", - "description": "If expand is true filter anomaly records by the partitionFieldValue" - }, "from": { "type": "int", "description": "skips a number of buckets" diff --git a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json index 7e71ba740d1..87bb854cb45 100644 --- a/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json +++ b/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json @@ -36,10 +36,6 @@ "record_score": { "type": "double" }, - "partition_value": { - "type": "string", - "description": "Filter anomaly records by the partitionFieldValue" - }, "sort": { "type": "string", "description": "Sort records by a particular field"