From 688b5cc202425f0ee649335dd460804b46b91c87 Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 29 Nov 2016 16:04:08 +0000 Subject: [PATCH] Renamed REST path parameters to snake case. (elastic/elasticsearch#367) * Renamed REST path parameters to snake case. And added missing parameter descriptions * Document endpoint which accept body parameters * Endpoints that support body parameters must also accept POST Original commit: elastic/x-pack-elasticsearch@2cad2e8af66b2d2ae5df24b8b0a07ad1d2d08a06 --- .../influencers/RestGetInfluencersAction.java | 6 ++-- .../RestGetModelSnapshotsAction.java | 2 ++ .../api/xpack.prelert.close_data.json | 6 ++-- .../xpack.prelert.delete_model_snapshot.json | 8 ++--- .../api/xpack.prelert.flush_data.json | 9 +++-- .../api/xpack.prelert.get_buckets.json | 35 ++++++++++++------- .../api/xpack.prelert.get_categories.json | 16 +++++---- .../api/xpack.prelert.get_influencers.json | 14 +++++--- .../api/xpack.prelert.get_jobs.json | 2 +- .../xpack.prelert.get_model_snapshots.json | 14 ++++---- .../api/xpack.prelert.get_records.json | 24 ++++++++----- .../api/xpack.prelert.post_data.json | 6 ++-- .../api/xpack.prelert.put_job.json | 2 +- ...relert.put_model_snapshot_description.json | 8 ++--- .../xpack.prelert.revert_model_snapshot.json | 14 ++++---- .../xpack.prelert.start_job_scheduler.json | 4 ++- .../test/delete_model_snapshot.yaml | 18 +++++----- .../test/get_model_snapshots.yaml | 10 +++--- .../test/jobs_get_result_buckets.yaml | 4 +-- .../test/jobs_get_result_categories.yaml | 6 ++-- .../test/jobs_get_result_influencers.yaml | 2 +- .../test/jobs_get_result_records.yaml | 2 +- .../rest-api-spec/test/jobs_get_stats.yaml | 4 +-- .../rest-api-spec/test/post_data.yaml | 16 ++++----- .../test/put_model_snapshot_description.yaml | 18 +++++----- .../test/revert_model_snapshot.yaml | 28 +++++++-------- 26 files changed, 154 insertions(+), 124 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/influencers/RestGetInfluencersAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/influencers/RestGetInfluencersAction.java index 66cd25ddcad..35b92f93c09 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/influencers/RestGetInfluencersAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/influencers/RestGetInfluencersAction.java @@ -32,8 +32,10 @@ public class RestGetInfluencersAction extends BaseRestHandler { super(settings); this.transportAction = transportAction; controller.registerHandler(RestRequest.Method.GET, - PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/influencers", - this); + PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/influencers", this); + // endpoints that support body parameters must also accept POST + controller.registerHandler(RestRequest.Method.POST, + PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/influencers", this); } @Override diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 0a8afd228b4..307cac0b9f6 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -52,6 +52,8 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler { super(settings); this.transportGetModelSnapshotsAction = transportGetModelSnapshotsAction; controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "modelsnapshots/{jobId}", this); + // endpoints that support body parameters must also accept POST + controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "modelsnapshots/{jobId}", this); } @Override diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.close_data.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.close_data.json index 11a830d7257..135a7fa8de0 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.close_data.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.close_data.json @@ -2,10 +2,10 @@ "xpack.prelert.close_data": { "methods": [ "POST" ], "url": { - "path": "/_xpack/prelert/data/{jobId}/_close", - "paths": [ "/_xpack/prelert/data/{jobId}/_close" ], + "path": "/_xpack/prelert/data/{job_id}/_close", + "paths": [ "/_xpack/prelert/data/{job_id}/_close" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The name of the job to close" diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.delete_model_snapshot.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.delete_model_snapshot.json index 48e689279f8..9fa7341b5e1 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.delete_model_snapshot.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.delete_model_snapshot.json @@ -2,15 +2,15 @@ "xpack.prelert.delete_model_snapshot": { "methods": [ "DELETE" ], "url": { - "path": "/_xpack/prelert/modelsnapshots/{jobId}/{snapshotId}", - "paths": [ "/_xpack/prelert/modelsnapshots/{jobId}/{snapshotId}" ], + "path": "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}", + "paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The ID of the job to fetch" }, - "snapshotId": { + "snapshot_id": { "type": "string", "required": true, "description": "The Snapshot ID of the job to fetch" diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.flush_data.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.flush_data.json index e6e59bb19fe..a0faac96037 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.flush_data.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.flush_data.json @@ -4,12 +4,12 @@ "POST" ], "url": { - "path": "/_xpack/prelert/data/{jobId}/_flush", + "path": "/_xpack/prelert/data/{job_id}/_flush", "paths": [ - "/_xpack/prelert/data/{jobId}/_flush" + "/_xpack/prelert/data/{job_id}/_flush" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The name of the job to flush" @@ -33,6 +33,9 @@ "description": "Setting this tells the Engine API that no data prior to advanceTime is expected" } } + }, + "body": { + "description": "Flush parameters" } } } \ No newline at end of file diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_buckets.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_buckets.json index 3f0eb8dc950..408ff1832fe 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_buckets.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_buckets.json @@ -2,29 +2,34 @@ "xpack.prelert.get_buckets": { "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/prelert/results/{jobId}/buckets/{timestamp}", + "path": "/_xpack/prelert/results/{job_id}/buckets/{timestamp}", "paths": [ - "/_xpack/prelert/results/{jobId}/buckets/{timestamp}", - "/_xpack/prelert/results/{jobId}/buckets" + "/_xpack/prelert/results/{job_id}/buckets/{timestamp}", + "/_xpack/prelert/results/{job_id}/buckets" ], "parts": { - "jobId": { + "job_id": { "type" : "string", - "required": true + "required": true, + "description": "ID of the job to get bucket results from" }, "timestamp": { - "type" : "string" + "type" : "string", + "description" : "The timestamp of the desired single bucket result" } }, "params": { "expand": { - "type": "boolean" + "type": "boolean", + "description" : "Include anomaly records" }, "includeInterim": { - "type": "boolean" + "type": "boolean", + "description" : "Include interim results" }, "partitionValue": { - "type": "string" + "type": "string", + "description": "If expand is true filter anomaly records by the partitionFieldValue" }, "from": { "type": "int", @@ -35,16 +40,20 @@ "description": "specifies a max number of buckets to get" }, "start": { - "type": "string" + "type": "string", + "description" : "Start time filter for buckets" }, "end": { - "type": "string" + "type": "string", + "description" : "End time filter for buckets" }, "anomalyScore": { - "type": "double" + "type": "double", + "description": "Filter for the most anomalous buckets" }, "maxNormalizedProbability": { - "type": "double" + "type": "double", + "description": "Filter for buckets containing the most anomalous records" } } }, diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_categories.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_categories.json index 40fa3855a22..87e4075e0f6 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_categories.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_categories.json @@ -2,18 +2,20 @@ "xpack.prelert.get_categories": { "methods": [ "GET" ], "url": { - "path": "/_xpack/prelert/results/{jobId}/categorydefinitions/{categoryId}", + "path": "/_xpack/prelert/results/{job_id}/categorydefinitions/{category_id}", "paths": [ - "/_xpack/prelert/results/{jobId}/categorydefinitions/{categoryId}", - "/_xpack/prelert/results/{jobId}/categorydefinitions/" + "/_xpack/prelert/results/{job_id}/categorydefinitions/{category_id}", + "/_xpack/prelert/results/{job_id}/categorydefinitions/" ], "parts": { - "jobId": { + "job_id": { "type" : "string", - "required": true + "required": true, + "description": "The name of the job" }, - "categoryId": { - "type" : "string" + "category_id": { + "type" : "string", + "description" : "The identifier of the category definition of interest" } }, "params": { diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_influencers.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_influencers.json index fddf2c8a55e..48baf3185d9 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_influencers.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_influencers.json @@ -1,18 +1,19 @@ { "xpack.prelert.get_influencers": { - "methods": [ "GET" ], + "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/prelert/results/{jobId}/influencers", - "paths": [ "/_xpack/prelert/results/{jobId}/influencers" ], + "path": "/_xpack/prelert/results/{job_id}/influencers", + "paths": [ "/_xpack/prelert/results/{job_id}/influencers" ], "parts": { - "jobId": { + "job_id": { "type" : "string", "required": true } }, "params": { "includeInterim": { - "type": "boolean" + "type": "boolean", + "description" : "Include interim results" }, "from": { "type": "int", @@ -45,6 +46,9 @@ "description": "whether the results should be sorted in decending order" } } + }, + "body": { + "description": "Influencer selection criteria" } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_jobs.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_jobs.json index 0b2720c27f6..9aa13ee6c3d 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_jobs.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_jobs.json @@ -31,7 +31,7 @@ } }, "body": { - "description" : "Job selection criteria" + "description": "Job selection criteria" } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_model_snapshots.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_model_snapshots.json index ab9062dadfd..3062a7af96d 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_model_snapshots.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_model_snapshots.json @@ -1,11 +1,11 @@ { "xpack.prelert.get_model_snapshots": { - "methods": [ "GET" ], + "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/prelert/modelsnapshots/{jobId}", - "paths": [ "/_xpack/prelert/modelsnapshots/{jobId}" ], + "path": "/_xpack/prelert/modelsnapshots/{job_id}", + "paths": [ "/_xpack/prelert/modelsnapshots/{job_id}" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The ID of the job to fetch" @@ -14,7 +14,7 @@ "params": { "from": { "type": "integer", - "description": "" + "description": "Skips a number of documents" }, "size": { "type": "integer", @@ -42,6 +42,8 @@ } } }, - "body": null + "body": { + "description": "Model snapshot selection criteria" + } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_records.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_records.json index e3fbdfa0596..d7faf93bfac 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_records.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.get_records.json @@ -2,10 +2,10 @@ "xpack.prelert.get_records": { "methods": [ "GET" ], "url": { - "path": "/_xpack/prelert/results/{jobId}/records", - "paths": [ "/_xpack/prelert/results/{jobId}/records" ], + "path": "/_xpack/prelert/results/{job_id}/records", + "paths": [ "/_xpack/prelert/results/{job_id}/records" ], "parts": { - "jobId": { + "job_id": { "type" : "string", "required": true } @@ -15,7 +15,8 @@ "type": "boolean" }, "includeInterim": { - "type": "boolean" + "type": "boolean", + "description" : "Include interim results" }, "from": { "type": "int", @@ -27,11 +28,13 @@ }, "start": { "type": "string", - "required": true + "required": true, + "description" : "Start time filter for records" }, "end": { "type": "string", - "required": true + "required": true, + "description" : "End time filter for records" }, "anomalyScore": { "type": "double" @@ -40,13 +43,16 @@ "type": "double" }, "partitionValue": { - "type": "string" + "type": "string", + "description": "Filter anomaly records by the partitionFieldValue" }, "sort": { - "type": "string" + "type": "string", + "description": "Sort records by a particular field" }, "desc": { - "type": "boolean" + "type": "boolean", + "description": "Set the sort direction" } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.post_data.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.post_data.json index eb6bbc73115..19817710e92 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.post_data.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.post_data.json @@ -2,10 +2,10 @@ "xpack.prelert.post_data": { "methods": [ "POST" ], "url": { - "path": "/_xpack/prelert/data/{jobId}", - "paths": [ "/_xpack/prelert/data/{jobId}" ], + "path": "/_xpack/prelert/data/{job_id}", + "paths": [ "/_xpack/prelert/data/{job_id}" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The name of the job receiving the data" diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_job.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_job.json index b9013d80751..f16ea6a46f6 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_job.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_job.json @@ -7,7 +7,7 @@ "params": { "overwrite": { "type": "boolean", - "description": "" + "description": "Overwrite an existing job" } } }, diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_model_snapshot_description.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_model_snapshot_description.json index a115115ecc5..ed1ec357f97 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_model_snapshot_description.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.put_model_snapshot_description.json @@ -2,15 +2,15 @@ "xpack.prelert.put_model_snapshot_description": { "methods": [ "PUT" ], "url": { - "path": "/_xpack/prelert/modelsnapshots/{jobId}/{snapshotId}/description", - "paths": [ "/_xpack/prelert/modelsnapshots/{jobId}/{snapshotId}/description" ], + "path": "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}/description", + "paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}/description" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The ID of the job to fetch" }, - "snapshotId": { + "snapshot_id": { "type": "string", "required": true, "description": "The ID of the snapshot whose description is to be updated" diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.revert_model_snapshot.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.revert_model_snapshot.json index c1cee0671f8..441d8baada5 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.revert_model_snapshot.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.revert_model_snapshot.json @@ -2,20 +2,16 @@ "xpack.prelert.revert_model_snapshot": { "methods": [ "POST" ], "url": { - "path": "/_xpack/prelert/modelsnapshots/{jobId}/_revert", - "paths": [ "/_xpack/prelert/modelsnapshots/{jobId}/_revert" ], + "path": "/_xpack/prelert/modelsnapshots/{job_id}/_revert", + "paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/_revert" ], "parts": { - "jobId": { + "job_id": { "type": "string", "required": true, "description": "The ID of the job to fetch" } }, "params": { - "from": { - "type": "integer", - "description": "" - }, "time": { "type": "date", "description": "revert to a snapshot with a timestamp no later than this time" @@ -34,6 +30,8 @@ } } }, - "body": null + "body": { + "description": "Model snapshot selection criteria" + } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.start_job_scheduler.json b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.start_job_scheduler.json index f2d8d8278ac..4c68d376629 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.start_job_scheduler.json +++ b/elasticsearch/src/test/resources/rest-api-spec/api/xpack.prelert.start_job_scheduler.json @@ -24,6 +24,8 @@ } } }, - "body": null + "body": { + "description": "The start scheduler parameters" + } } } diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/delete_model_snapshot.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/delete_model_snapshot.yaml index 2ac2221fd77..8ea4f1c1239 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/delete_model_snapshot.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/delete_model_snapshot.yaml @@ -78,10 +78,10 @@ setup: - do: catch: param xpack.prelert.delete_model_snapshot: - jobId: "foo" + job_id: "foo" --- -"Test delete snapshot missing jobId": +"Test delete snapshot missing job_id": - do: catch: param xpack.prelert.delete_model_snapshot: @@ -91,7 +91,7 @@ setup: "Test valid delete snapshot": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" - match: { count: 2 } - do: @@ -103,8 +103,8 @@ setup: - do: xpack.prelert.delete_model_snapshot: - jobId: "foo" - snapshotId: "foo1" + job_id: "foo" + snapshot_id: "foo1" - match: { acknowledged: true } - do: @@ -113,7 +113,7 @@ setup: - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" - match: { count: 1 } - match: { modelSnapshots.0.snapshotId: "foo2"} @@ -128,11 +128,11 @@ setup: "Test delete with in-use model": - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" snapshotId: "foo2" - do: catch: request xpack.prelert.delete_model_snapshot: - jobId: "foo" - snapshotId: "foo2" + job_id: "foo" + snapshot_id: "foo2" diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/get_model_snapshots.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/get_model_snapshots.yaml index 25505c65513..d3c95730a45 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/get_model_snapshots.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/get_model_snapshots.yaml @@ -32,7 +32,7 @@ setup: "Test get model snapshots API with no params": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" - match: { count: 2 } @@ -43,7 +43,7 @@ setup: "Test get model snapshots API with start/end": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" @@ -56,7 +56,7 @@ setup: "Test get model snapshots API with ascending": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" desc: false @@ -68,7 +68,7 @@ setup: "Test get model snapshots API with size": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" size: 1 @@ -81,7 +81,7 @@ setup: "Test get model snapshots API with from": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" from: 1 diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_buckets.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_buckets.yaml index c794ac6a872..8c28a334da8 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_buckets.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_buckets.yaml @@ -28,7 +28,7 @@ setup: "Test result buckets api": - do: xpack.prelert.get_buckets: - jobId: "farequote" + job_id: "farequote" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" @@ -41,7 +41,7 @@ setup: "Test result single bucket api": - do: xpack.prelert.get_buckets: - jobId: "farequote" + job_id: "farequote" timestamp: "2016-06-01T00:00:00Z" - match: { buckets.0.timestamp: 1464739200000} diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_categories.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_categories.yaml index 52108efbc25..3eff1013539 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_categories.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_categories.yaml @@ -26,7 +26,7 @@ setup: "Test result categories api": - do: xpack.prelert.get_categories: - jobId: "farequote" + job_id: "farequote" - match: { count: 2 } - match: { categories.0.jobId: farequote } @@ -38,8 +38,8 @@ setup: "Test result category api": - do: xpack.prelert.get_categories: - jobId: "farequote" - categoryId: "1" + job_id: "farequote" + category_id: "1" - match: { categories.0.jobId: farequote } - match: { categories.0.categoryId: 1 } diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_influencers.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_influencers.yaml index 3c63dfe03ca..78b114290d6 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_influencers.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_influencers.yaml @@ -36,7 +36,7 @@ setup: "Test result influencers api": - do: xpack.prelert.get_influencers: - jobId: "farequote" + job_id: "farequote" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_records.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_records.yaml index 6e47801e414..24d5a4f9dc5 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_records.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_result_records.yaml @@ -42,7 +42,7 @@ setup: "Test result records api": - do: xpack.prelert.get_records: - jobId: "farequote" + job_id: "farequote" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_stats.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_stats.yaml index 6e7b8ffe631..fc2289974ef 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_stats.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/jobs_get_stats.yaml @@ -54,14 +54,14 @@ setup: - do: xpack.prelert.post_data: - jobId: job-stats-test + job_id: job-stats-test body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","time":"1403481600"} - do: xpack.prelert.flush_data: - jobId: job-stats-test + job_id: job-stats-test - match: { acknowledged: true } diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/post_data.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/post_data.yaml index 0bcbc9c7091..ef5b3c2452b 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/post_data.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/post_data.yaml @@ -20,7 +20,7 @@ setup: "Test POST data job api, flush, close and verify DataCounts doc": - do: xpack.prelert.post_data: - jobId: farequote + job_id: farequote body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"} @@ -37,12 +37,12 @@ setup: - do: xpack.prelert.flush_data: - jobId: farequote + job_id: farequote - match: { acknowledged: true } - do: xpack.prelert.close_data: - jobId: farequote + job_id: farequote - match: { acknowledged: true } - do: @@ -72,7 +72,7 @@ setup: - do: catch: /parse_exception/ xpack.prelert.post_data: - jobId: foo + job_id: foo resetStart: not_a_date body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} @@ -81,7 +81,7 @@ setup: - do: catch: /parse_exception/ xpack.prelert.post_data: - jobId: foo + job_id: foo resetEnd: end_not_a_date body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} @@ -92,17 +92,17 @@ setup: - do: catch: /parse_exception/ xpack.prelert.flush_data: - jobId: foo + job_id: foo start: not_a_date - do: catch: /parse_exception/ xpack.prelert.flush_data: - jobId: foo + job_id: foo end: end_not_a_date - do: catch: /parse_exception/ xpack.prelert.flush_data: - jobId: foo + job_id: foo advanceTime: advance_time_not_a_date diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/put_model_snapshot_description.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/put_model_snapshot_description.yaml index 9b1926e6180..0b87a19089b 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/put_model_snapshot_description.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/put_model_snapshot_description.yaml @@ -46,8 +46,8 @@ setup: - do: catch: request xpack.prelert.put_model_snapshot_description: - jobId: "foo" - snapshotId: "foo" + job_id: "foo" + snapshot_id: "foo" body: > { "some_field": "foo" @@ -57,7 +57,7 @@ setup: "Test with valid description": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" description: "new_description" - match: { count: 0 } @@ -65,8 +65,8 @@ setup: - do: xpack.prelert.put_model_snapshot_description: - jobId: "foo" - snapshotId: "foo" + job_id: "foo" + snapshot_id: "foo" body: > { "description": "new_description" @@ -78,7 +78,7 @@ setup: - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" description: "new_description" - match: { count: 1 } @@ -89,7 +89,7 @@ setup: "Test with conflict against existing description": - do: xpack.prelert.get_model_snapshots: - jobId: "foo" + job_id: "foo" description: "bar" - match: { count: 1 } @@ -100,8 +100,8 @@ setup: - do: catch: request xpack.prelert.put_model_snapshot_description: - jobId: "foo" - snapshotId: "foo" + job_id: "foo" + snapshot_id: "foo" body: > { "description": "bar" diff --git a/elasticsearch/src/test/resources/rest-api-spec/test/revert_model_snapshot.yaml b/elasticsearch/src/test/resources/rest-api-spec/test/revert_model_snapshot.yaml index a09746ec7d0..80b8e58bde6 100644 --- a/elasticsearch/src/test/resources/rest-api-spec/test/revert_model_snapshot.yaml +++ b/elasticsearch/src/test/resources/rest-api-spec/test/revert_model_snapshot.yaml @@ -73,18 +73,18 @@ setup: index: prelertresults-foo --- -"Test revert model with only jobId": +"Test revert model with only job_id": - do: catch: request xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" --- "Test revert model with invalid time": - do: catch: request xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" time: "foo" --- @@ -92,7 +92,7 @@ setup: - do: catch: /resource_not_found_exception/ xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" snapshotId: "not_exist" --- @@ -100,14 +100,14 @@ setup: - do: catch: /resource_not_found_exception/ xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" description: "foo" --- "Test revert model with valid snapshotId": - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" snapshotId: "foo1" - match: { exists: true } @@ -120,7 +120,7 @@ setup: - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" snapshotId: "foo2" - match: { exists: true } @@ -135,7 +135,7 @@ setup: "Test revert model with valid time": - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" time: "2016-06-02T01:00:00Z" - match: { exists: true } @@ -148,7 +148,7 @@ setup: - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" time: "2016-06-01T01:00:00Z" - match: { exists: true } @@ -163,7 +163,7 @@ setup: "Test revert model with valid description": - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" description: "first" - match: { exists: true } @@ -176,7 +176,7 @@ setup: - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" description: "second" - match: { exists: true } @@ -191,7 +191,7 @@ setup: "Test revert model with deleteInterveningResults": - do: xpack.prelert.get_buckets: - jobId: "foo" + job_id: "foo" start: "2016-01-01T00:00:00Z" end: "2016-12-01T00:00:00Z" @@ -199,7 +199,7 @@ setup: - do: xpack.prelert.revert_model_snapshot: - jobId: "foo" + job_id: "foo" snapshotId: "foo2" deleteInterveningResults: true @@ -209,7 +209,7 @@ setup: - do: xpack.prelert.get_buckets: - jobId: "foo" + job_id: "foo" start: "2016-01-01T00:00:00Z" end: "2016-12-01T00:00:00Z"