[ML] Give jobs meaningful and unique names in the yaml rest tests. (elastic/x-pack-elasticsearch#1271)
Original commit: elastic/x-pack-elasticsearch@b096de55c1
This commit is contained in:
parent
c62f6f8177
commit
f3f387bd9c
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-1
|
||||
job_id: datafeeds-crud-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
"detectors" :[{"function":"count"}]
|
||||
|
@ -18,7 +18,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-2
|
||||
job_id: datafeeds-crud-2
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -65,12 +65,12 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
- match: { datafeed_id: "test-datafeed-1" }
|
||||
- match: { job_id: "job-1" }
|
||||
- match: { job_id: "datafeeds-crud-1" }
|
||||
- match: { indexes: ["index-foo"] }
|
||||
- match: { types: ["type-bar"] }
|
||||
- match: { scroll_size: 1000 }
|
||||
|
@ -84,7 +84,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"datafeeds-crud-2",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
@ -108,19 +108,19 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
- match: { datafeed_id: "test-datafeed-1" }
|
||||
|
||||
- do:
|
||||
catch: /A datafeed \[test-datafeed-1\] already exists for job \[job-1\]/
|
||||
catch: /A datafeed \[test-datafeed-1\] already exists for job \[datafeeds-crud-1\]/
|
||||
xpack.ml.put_datafeed:
|
||||
datafeed_id: test-datafeed-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"],
|
||||
"query":{"match_all_mispelled":{}}
|
||||
|
@ -146,7 +146,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"],
|
||||
"scroll_size": 2000,
|
||||
|
@ -165,7 +165,7 @@ setup:
|
|||
"query_delay": "0s"
|
||||
}
|
||||
- match: { datafeed_id: "test-datafeed-1" }
|
||||
- match: { job_id: "job-1" }
|
||||
- match: { job_id: "datafeeds-crud-1" }
|
||||
- match: { indexes: ["index-*"] }
|
||||
- match: { types: ["type-bar"] }
|
||||
- match: { scroll_size: 10000 }
|
||||
|
@ -179,7 +179,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"],
|
||||
"scroll_size": 2000
|
||||
|
@ -190,10 +190,10 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id": "job-2"
|
||||
"job_id": "datafeeds-crud-2"
|
||||
}
|
||||
- match: { datafeed_id: "test-datafeed-1" }
|
||||
- match: { job_id: "job-2" }
|
||||
- match: { job_id: "datafeeds-crud-2" }
|
||||
- match: { indexes: ["index-foo"] }
|
||||
- match: { types: ["type-bar"] }
|
||||
|
||||
|
@ -214,7 +214,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"],
|
||||
"scroll_size": 2000
|
||||
|
@ -226,7 +226,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id": "job-3"
|
||||
"job_id": "update-datafeed-missing-job"
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -236,7 +236,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
@ -246,18 +246,18 @@ setup:
|
|||
datafeed_id: test-datafeed-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"datafeeds-crud-2",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
||||
- do:
|
||||
catch: /A datafeed \[test-datafeed-2\] already exists for job \[job-2\]/
|
||||
catch: /A datafeed \[test-datafeed-2\] already exists for job \[datafeeds-crud-2\]/
|
||||
xpack.ml.update_datafeed:
|
||||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id": "job-2"
|
||||
"job_id": "datafeeds-crud-2"
|
||||
}
|
||||
|
||||
---
|
||||
|
@ -274,7 +274,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"],
|
||||
"chunking_config": {"mode":"manual","time_span": "1h"}
|
||||
|
@ -290,7 +290,7 @@ setup:
|
|||
datafeed_id: test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"datafeeds-crud-1",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: foo
|
||||
job_id: delete-model-snapshot
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "delete-model-snapshot",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span" : "1h",
|
||||
|
@ -19,20 +19,20 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: foo
|
||||
job_id: delete-model-snapshot
|
||||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: foo
|
||||
job_id: delete-model-snapshot
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-delete-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "foo-inactive-snapshot"
|
||||
id: "delete-model-snapshot-inactive-snapshot"
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "delete-model-snapshot",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"snapshot_id": "inactive-snapshot",
|
||||
"description": "first",
|
||||
|
@ -45,7 +45,7 @@ setup:
|
|||
index:
|
||||
index: .ml-state
|
||||
type: model_state
|
||||
id: "foo-inactive-snapshot#1"
|
||||
id: "delete-model-snapshot-inactive-snapshot#1"
|
||||
body: >
|
||||
{
|
||||
"state": "a"
|
||||
|
@ -55,7 +55,7 @@ setup:
|
|||
index:
|
||||
index: .ml-state
|
||||
type: model_state
|
||||
id: "foo-inactive-snapshot#2"
|
||||
id: "delete-model-snapshot-inactive-snapshot#2"
|
||||
body: >
|
||||
{
|
||||
"state": "b"
|
||||
|
@ -63,12 +63,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-delete-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "foo-active-snapshot"
|
||||
id: "delete-model-snapshot-active-snapshot"
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "delete-model-snapshot",
|
||||
"timestamp": "2016-06-01T00:00:00Z",
|
||||
"snapshot_id": "active-snapshot",
|
||||
"description": "second",
|
||||
|
@ -82,11 +82,11 @@ setup:
|
|||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-delete-model-snapshot
|
||||
|
||||
- do:
|
||||
xpack.ml.update_job:
|
||||
job_id: foo
|
||||
job_id: delete-model-snapshot
|
||||
body: >
|
||||
{
|
||||
"model_snapshot_id": "active-snapshot"
|
||||
|
@ -97,7 +97,7 @@ setup:
|
|||
- do:
|
||||
catch: param
|
||||
xpack.ml.delete_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "delete-model-snapshot"
|
||||
|
||||
---
|
||||
"Test delete snapshot missing job_id":
|
||||
|
@ -110,7 +110,7 @@ setup:
|
|||
"Test valid delete snapshot":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "delete-model-snapshot"
|
||||
- match: { count: 2 }
|
||||
|
||||
- do:
|
||||
|
@ -122,13 +122,13 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.delete_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "delete-model-snapshot"
|
||||
snapshot_id: "inactive-snapshot"
|
||||
- match: { acknowledged: true }
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-delete-model-snapshot
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
|
@ -136,7 +136,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "delete-model-snapshot"
|
||||
- match: { count: 1 }
|
||||
- match: { model_snapshots.0.snapshot_id: "active-snapshot"}
|
||||
|
||||
|
@ -153,7 +153,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.delete_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "delete-model-snapshot"
|
||||
snapshot_id: "active-snapshot"
|
||||
|
||||
---
|
||||
|
@ -162,4 +162,4 @@ setup:
|
|||
catch: missing
|
||||
xpack.ml.delete_model_snapshot:
|
||||
job_id: "non-existent-job"
|
||||
snapshot_id: "foo"
|
||||
snapshot_id: "delete-model-snapshot"
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
xpack.ml.put_filter:
|
||||
body: >
|
||||
{
|
||||
"id": "foo",
|
||||
"id": "filter-foo",
|
||||
"items": ["abc", "xyz"]
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ setup:
|
|||
xpack.ml.put_filter:
|
||||
body: >
|
||||
{
|
||||
"id": "foo2",
|
||||
"id": "filter-foo2",
|
||||
"items": ["123", "lmnop"]
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match:
|
||||
filters.0:
|
||||
id: "foo"
|
||||
id: "filter-foo"
|
||||
items: ["abc", "xyz"]
|
||||
|
||||
---
|
||||
|
@ -49,12 +49,12 @@ setup:
|
|||
- match: { count: 2 }
|
||||
- match:
|
||||
filters.0:
|
||||
id: "foo"
|
||||
id: "filter-foo"
|
||||
items: ["abc", "xyz"]
|
||||
|
||||
- match:
|
||||
filters.1:
|
||||
id: "foo2"
|
||||
id: "filter-foo2"
|
||||
items: ["123", "lmnop"]
|
||||
|
||||
- do:
|
||||
|
@ -70,19 +70,19 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
from: 0
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
size: 1
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
from: 0
|
||||
size: 1
|
||||
---
|
||||
|
@ -91,7 +91,7 @@ setup:
|
|||
xpack.ml.put_filter:
|
||||
body: >
|
||||
{
|
||||
"id": "foo2",
|
||||
"id": "filter-foo2",
|
||||
"items": ["abc", "xyz"]
|
||||
}
|
||||
|
||||
|
@ -99,12 +99,12 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo2"
|
||||
filter_id: "filter-foo2"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match:
|
||||
filters.0:
|
||||
id: "foo2"
|
||||
id: "filter-foo2"
|
||||
items: ["abc", "xyz"]
|
||||
|
||||
---
|
||||
|
@ -121,10 +121,10 @@ setup:
|
|||
"Test delete in-use filter":
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote2
|
||||
job_id: filter-crud
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote2",
|
||||
"job_id":"filter-crud",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "3600s",
|
||||
|
@ -134,7 +134,7 @@ setup:
|
|||
"rule_conditions": [
|
||||
{
|
||||
"condition_type": "categorical",
|
||||
"value_filter": "foo"
|
||||
"value_filter": "filter-foo"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ setup:
|
|||
- do:
|
||||
catch: conflict
|
||||
xpack.ml.delete_filter:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
||||
---
|
||||
"Test non-existing filter":
|
||||
|
@ -163,19 +163,19 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match:
|
||||
filters.0:
|
||||
id: "foo"
|
||||
id: "filter-foo"
|
||||
items: ["abc", "xyz"]
|
||||
|
||||
- do:
|
||||
xpack.ml.delete_filter:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
||||
- do:
|
||||
catch: missing
|
||||
xpack.ml.get_filters:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-1
|
||||
job_id: get-datafeed-stats-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"get-datafeed-stats-1",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
"detectors" :[{"function":"count"}]
|
||||
|
@ -18,10 +18,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-2
|
||||
job_id: get-datafeed-stats-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"get-datafeed-stats-2",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
"detectors" :[{"function":"count"}]
|
||||
|
@ -52,7 +52,7 @@ setup:
|
|||
datafeed_id: datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"get-datafeed-stats-1",
|
||||
"indexes":["index-1"],
|
||||
"types":["type-1"]
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ setup:
|
|||
datafeed_id: datafeed-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"get-datafeed-stats-2",
|
||||
"indexes":["index-2"],
|
||||
"types":["type-2"]
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: job-1
|
||||
job_id: get-datafeed-stats-1
|
||||
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
|
@ -118,7 +118,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: job-1
|
||||
job_id: get-datafeed-stats-1
|
||||
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
|
@ -127,7 +127,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: job-2
|
||||
job_id: get-datafeed-stats-2
|
||||
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-1
|
||||
job_id: get-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"get-datafeed-1",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
"detectors" :[{"function":"count"}]
|
||||
|
@ -18,10 +18,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-2
|
||||
job_id: get-datafeed-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"get-datafeed-2",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
"detectors" :[{"function":"count"}]
|
||||
|
@ -36,7 +36,7 @@ setup:
|
|||
datafeed_id: datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"get-datafeed-1",
|
||||
"indexes":["index-1"],
|
||||
"types":["type-1"]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ setup:
|
|||
datafeed_id: datafeed-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"get-datafeed-2",
|
||||
"indexes":["index-2"],
|
||||
"types":["type-2"]
|
||||
}
|
||||
|
@ -66,13 +66,13 @@ setup:
|
|||
xpack.ml.get_datafeeds:
|
||||
datafeed_id: datafeed-1
|
||||
- match: { datafeeds.0.datafeed_id: "datafeed-1"}
|
||||
- match: { datafeeds.0.job_id: "job-1"}
|
||||
- match: { datafeeds.0.job_id: "get-datafeed-1"}
|
||||
|
||||
- do:
|
||||
xpack.ml.get_datafeeds:
|
||||
datafeed_id: datafeed-2
|
||||
- match: { datafeeds.0.datafeed_id: "datafeed-2"}
|
||||
- match: { datafeeds.0.job_id: "job-2"}
|
||||
- match: { datafeeds.0.job_id: "get-datafeed-2"}
|
||||
|
||||
---
|
||||
"Test explicit get all datafeeds":
|
||||
|
@ -82,9 +82,9 @@ setup:
|
|||
datafeed_id: _all
|
||||
- match: { count: 2 }
|
||||
- match: { datafeeds.0.datafeed_id: "datafeed-1"}
|
||||
- match: { datafeeds.0.job_id: "job-1"}
|
||||
- match: { datafeeds.0.job_id: "get-datafeed-1"}
|
||||
- match: { datafeeds.1.datafeed_id: "datafeed-2"}
|
||||
- match: { datafeeds.1.job_id: "job-2"}
|
||||
- match: { datafeeds.1.job_id: "get-datafeed-2"}
|
||||
|
||||
---
|
||||
"Test implicit get all datafeeds":
|
||||
|
@ -93,6 +93,6 @@ setup:
|
|||
xpack.ml.get_datafeeds: {}
|
||||
- match: { count: 2 }
|
||||
- match: { datafeeds.0.datafeed_id: "datafeed-1"}
|
||||
- match: { datafeeds.0.job_id: "job-1"}
|
||||
- match: { datafeeds.0.job_id: "get-datafeed-1"}
|
||||
- match: { datafeeds.1.datafeed_id: "datafeed-2"}
|
||||
- match: { datafeeds.1.job_id: "job-2"}
|
||||
- match: { datafeeds.1.job_id: "get-datafeed-2"}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
xpack.ml.put_filter:
|
||||
body: >
|
||||
{
|
||||
"id": "foo",
|
||||
"id": "filter-foo",
|
||||
"items": ["abc", "xyz"]
|
||||
}
|
||||
|
||||
- do:
|
||||
xpack.ml.delete_filter:
|
||||
filter_id: "foo"
|
||||
filter_id: "filter-foo"
|
||||
|
||||
- do:
|
||||
xpack.ml.get_filters: {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: foo
|
||||
job_id: get-model-snapshots
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -15,27 +15,27 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-get-model-snapshots
|
||||
type: model_snapshot
|
||||
id: "foo-1"
|
||||
body: { "job_id": "foo", "snapshot_id": "1", "timestamp": "2016-06-02T00:00:00Z" }
|
||||
id: "get-model-snapshots-1"
|
||||
body: { "job_id": "get-model-snapshots", "snapshot_id": "1", "timestamp": "2016-06-02T00:00:00Z" }
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-get-model-snapshots
|
||||
type: model_snapshot
|
||||
id: "foo-2"
|
||||
body: { "job_id": "foo", "snapshot_id": "2", "timestamp": "2016-06-01T00:00:00Z" }
|
||||
id: "get-model-snapshots-2"
|
||||
body: { "job_id": "get-model-snapshots", "snapshot_id": "2", "timestamp": "2016-06-01T00:00:00Z" }
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-get-model-snapshots
|
||||
|
||||
---
|
||||
"Test get model snapshots API with no params":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
|
||||
- match: { count: 2 }
|
||||
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||
|
@ -45,7 +45,7 @@ setup:
|
|||
"Test get model snapshots API with _all":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
snapshot_id: "_all"
|
||||
|
||||
- match: { count: 2 }
|
||||
|
@ -56,7 +56,7 @@ setup:
|
|||
"Test get specific model snapshot":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
snapshot_id: "2"
|
||||
|
||||
- match: { count: 1 }
|
||||
|
@ -66,7 +66,7 @@ setup:
|
|||
"Test get model snapshots API with start/end":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
start: "2016-05-01T00:00:00Z"
|
||||
end: "2016-07-01T00:00:00Z"
|
||||
|
||||
|
@ -78,7 +78,7 @@ setup:
|
|||
"Test get model snapshots API with ascending":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
desc: false
|
||||
|
||||
- match: { count: 2 }
|
||||
|
@ -89,7 +89,7 @@ setup:
|
|||
"Test get model snapshots API with size":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
size: 1
|
||||
|
||||
- match: { count: 2 }
|
||||
|
@ -100,7 +100,7 @@ setup:
|
|||
"Test get model snapshots API with from":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "get-model-snapshots"
|
||||
from: 1
|
||||
|
||||
- match: { count: 2 }
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: job-crud-test-apis
|
||||
body: >
|
||||
{
|
||||
"description":"Analysis of response time by airline",
|
||||
|
@ -32,22 +32,22 @@
|
|||
"time_format":"yyyy-MM-dd HH:mm:ssX"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "farequote" }
|
||||
- match: { job_id: "job-crud-test-apis" }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_jobs:
|
||||
job_id: "farequote"
|
||||
job_id: "job-crud-test-apis"
|
||||
- match: { count: 1 }
|
||||
- match: { jobs.0.job_id: "farequote" }
|
||||
- match: { jobs.0.job_id: "job-crud-test-apis" }
|
||||
|
||||
- do:
|
||||
xpack.ml.delete_job:
|
||||
job_id: "farequote"
|
||||
job_id: "job-crud-test-apis"
|
||||
- match: { acknowledged: true }
|
||||
|
||||
- do:
|
||||
indices.exists:
|
||||
index: ".ml-anomalies-farequote"
|
||||
index: ".ml-anomalies-job-crud-test-apis"
|
||||
- is_false: ''
|
||||
|
||||
---
|
||||
|
@ -101,10 +101,10 @@
|
|||
"Test put job with id that is already taken":
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-id-already-taken
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-id-already-taken",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "3600000ms",
|
||||
|
@ -116,15 +116,15 @@
|
|||
"time_format":"yyyy-MM-dd HH:mm:ssX"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "farequote" }
|
||||
- match: { job_id: "jobs-crud-id-already-taken" }
|
||||
|
||||
- do:
|
||||
catch: /resource_already_exists_exception/
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-id-already-taken
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-id-already-taken",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -137,12 +137,12 @@
|
|||
}
|
||||
}
|
||||
- do:
|
||||
catch: /The job cannot be created with the Id 'farequote'. The Id is already used./
|
||||
catch: /The job cannot be created with the Id 'jobs-crud-id-already-taken'. The Id is already used./
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-id-already-taken
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-id-already-taken",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -157,10 +157,10 @@
|
|||
- do:
|
||||
catch: param
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-id-already-taken
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-id-already-taken",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -177,7 +177,7 @@
|
|||
"Test update job":
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: to-update
|
||||
job_id: jobs-crud-update-job
|
||||
body: >
|
||||
{
|
||||
"description":"Pre update description",
|
||||
|
@ -206,15 +206,15 @@
|
|||
"setting2": "custom2"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "to-update" }
|
||||
- match: { job_id: "jobs-crud-update-job" }
|
||||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: to-update
|
||||
job_id: jobs-crud-update-job
|
||||
|
||||
- do:
|
||||
xpack.ml.update_job:
|
||||
job_id: to-update
|
||||
job_id: jobs-crud-update-job
|
||||
body: >
|
||||
{
|
||||
"description":"Post update description",
|
||||
|
@ -238,7 +238,7 @@
|
|||
"setting3": "custom3"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "to-update" }
|
||||
- match: { job_id: "jobs-crud-update-job" }
|
||||
- match: { description: "Post update description" }
|
||||
- match: { model_plot_config.enabled: false }
|
||||
- match: { model_plot_config.terms: "foobar" }
|
||||
|
@ -264,10 +264,10 @@
|
|||
"Test delete job that is referred by a datafeed":
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: datafeed-job
|
||||
job_id: jobs-crud-datafeed-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"jobs-crud-datafeed-job",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -279,32 +279,32 @@
|
|||
"time_format":"yyyy-MM-dd HH:mm:ssX"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "datafeed-job" }
|
||||
- match: { job_id: "jobs-crud-datafeed-job" }
|
||||
|
||||
- do:
|
||||
xpack.ml.put_datafeed:
|
||||
datafeed_id: test-datafeed-1
|
||||
datafeed_id: jobs-crud-test-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"jobs-crud-datafeed-job",
|
||||
"indexes":["index-foo"],
|
||||
"types":["type-bar"]
|
||||
}
|
||||
- match: { datafeed_id: "test-datafeed-1" }
|
||||
- match: { datafeed_id: "jobs-crud-test-datafeed-1" }
|
||||
|
||||
- do:
|
||||
catch: /Cannot delete job \[datafeed-job\] because datafeed \[test-datafeed-1\] refers to it/
|
||||
catch: /Cannot delete job \[jobs-crud-datafeed-job\] because datafeed \[jobs-crud-test-datafeed-1\] refers to it/
|
||||
xpack.ml.delete_job:
|
||||
job_id: datafeed-job
|
||||
job_id: jobs-crud-datafeed-job
|
||||
---
|
||||
"Test close job":
|
||||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-close-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-close-job",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span":"1h",
|
||||
|
@ -316,23 +316,23 @@
|
|||
"time_format":"epoch"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "farequote" }
|
||||
- match: { job_id: "jobs-crud-close-job" }
|
||||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-close-job
|
||||
|
||||
- do:
|
||||
xpack.ml.post_data:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-close-job
|
||||
body: >
|
||||
{"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"}
|
||||
{"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"}
|
||||
{"airline":"AAL","responsetime":"132.2046","time":"1403481600"}
|
||||
{"airline":"JZA","responsetime":"990.4628","time":"1403481700"}
|
||||
|
||||
|
||||
- do:
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-close-job
|
||||
- match: { flushed: true }
|
||||
|
||||
- do:
|
||||
|
@ -343,7 +343,7 @@
|
|||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-close-job
|
||||
- match: { closed: true }
|
||||
|
||||
- do:
|
||||
|
@ -358,10 +358,10 @@
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-force-close-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"jobs-crud-force-close-job",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span":"1h",
|
||||
|
@ -373,23 +373,23 @@
|
|||
"time_format":"epoch"
|
||||
}
|
||||
}
|
||||
- match: { job_id: "farequote" }
|
||||
- match: { job_id: "jobs-crud-force-close-job" }
|
||||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-force-close-job
|
||||
|
||||
- do:
|
||||
xpack.ml.post_data:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-force-close-job
|
||||
body: >
|
||||
{"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"}
|
||||
{"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"}
|
||||
{"airline":"AAL","responsetime":"132.2046","time":"1403481600"}
|
||||
{"airline":"JZA","responsetime":"990.4628","time":"1403481700"}
|
||||
|
||||
|
||||
- do:
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-force-close-job
|
||||
- match: { flushed: true }
|
||||
|
||||
- do:
|
||||
|
@ -400,7 +400,7 @@
|
|||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-crud-force-close-job
|
||||
force: true
|
||||
- match: { closed: true }
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-1
|
||||
job_id: jobs-get-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-1",
|
||||
"job_id":"jobs-get-1",
|
||||
"description":"Job 1",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "300s",
|
||||
|
@ -19,10 +19,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: job-2
|
||||
job_id: jobs-get-2
|
||||
body: >
|
||||
{
|
||||
"job_id":"job-2",
|
||||
"job_id":"jobs-get-2",
|
||||
"description":"Job 2",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "600s",
|
||||
|
@ -48,14 +48,14 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_jobs:
|
||||
job_id: job-1
|
||||
- match: { jobs.0.job_id: "job-1"}
|
||||
job_id: jobs-get-1
|
||||
- match: { jobs.0.job_id: "jobs-get-1"}
|
||||
- match: { jobs.0.description: "Job 1"}
|
||||
|
||||
- do:
|
||||
xpack.ml.get_jobs:
|
||||
job_id: job-2
|
||||
- match: { jobs.0.job_id: "job-2"}
|
||||
job_id: jobs-get-2
|
||||
- match: { jobs.0.job_id: "jobs-get-2"}
|
||||
- match: { jobs.0.description: "Job 2"}
|
||||
|
||||
---
|
||||
|
@ -65,9 +65,9 @@ setup:
|
|||
xpack.ml.get_jobs:
|
||||
job_id: _all
|
||||
- match: { count: 2 }
|
||||
- match: { jobs.0.job_id: "job-1"}
|
||||
- match: { jobs.0.job_id: "jobs-get-1"}
|
||||
- match: { jobs.0.description: "Job 1"}
|
||||
- match: { jobs.1.job_id: "job-2"}
|
||||
- match: { jobs.1.job_id: "jobs-get-2"}
|
||||
- match: { jobs.1.description: "Job 2"}
|
||||
|
||||
---
|
||||
|
@ -76,7 +76,7 @@ setup:
|
|||
- do:
|
||||
xpack.ml.get_jobs: {}
|
||||
- match: { count: 2 }
|
||||
- match: { jobs.0.job_id: "job-1"}
|
||||
- match: { jobs.0.job_id: "jobs-get-1"}
|
||||
- match: { jobs.0.description: "Job 1"}
|
||||
- match: { jobs.1.job_id: "job-2"}
|
||||
- match: { jobs.1.job_id: "jobs-get-2"}
|
||||
- match: { jobs.1.description: "Job 2"}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-get-result-buckets
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -15,12 +15,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-buckets
|
||||
type: result
|
||||
id: "farequote_1464739200000_1"
|
||||
id: "jobs-get-result-buckets_1464739200000_1"
|
||||
body:
|
||||
{
|
||||
"job_id": "farequote",
|
||||
"job_id": "jobs-get-result-buckets",
|
||||
"result_type": "bucket",
|
||||
"timestamp": "2016-06-01T00:00:00Z",
|
||||
"bucket_span":1
|
||||
|
@ -28,12 +28,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-buckets
|
||||
type: result
|
||||
id: "farequote_1464739200000_2"
|
||||
id: "jobs-get-result-buckets_1464739200000_2"
|
||||
body:
|
||||
{
|
||||
"job_id": "farequote",
|
||||
"job_id": "jobs-get-result-buckets",
|
||||
"result_type": "bucket",
|
||||
"timestamp": "2016-08-01T00:00:00Z",
|
||||
"bucket_span":1,
|
||||
|
@ -42,33 +42,33 @@ setup:
|
|||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-buckets
|
||||
|
||||
---
|
||||
"Test result buckets api with time range":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
start: "2016-05-01T00:00:00Z"
|
||||
end: "2016-07-01T00:00:00Z"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { buckets.0.timestamp: 1464739200000 }
|
||||
- match: { buckets.0.job_id: farequote}
|
||||
- match: { buckets.0.job_id: jobs-get-result-buckets}
|
||||
- match: { buckets.0.result_type: bucket}
|
||||
|
||||
---
|
||||
"Test result buckets api":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
|
||||
- match: { count: 2 }
|
||||
- match: { buckets.0.timestamp: 1464739200000 }
|
||||
- match: { buckets.0.job_id: farequote}
|
||||
- match: { buckets.0.job_id: jobs-get-result-buckets}
|
||||
- match: { buckets.0.result_type: bucket}
|
||||
- match: { buckets.1.timestamp: 1470009600000 }
|
||||
- match: { buckets.1.job_id: farequote}
|
||||
- match: { buckets.1.job_id: jobs-get-result-buckets}
|
||||
- match: { buckets.1.result_type: bucket}
|
||||
- is_false: buckets.0.partition_scores
|
||||
- is_false: buckets.1.partition_scores
|
||||
|
@ -77,7 +77,7 @@ setup:
|
|||
"Test get buckets given exclude_interim is false":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
exclude_interim: false
|
||||
|
||||
- match: { count: 2 }
|
||||
|
@ -86,7 +86,7 @@ setup:
|
|||
"Test get buckets given exclude_interim is true":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
exclude_interim: true
|
||||
|
||||
- match: { count: 1 }
|
||||
|
@ -97,11 +97,11 @@ setup:
|
|||
"Test result single bucket api":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
|
||||
- match: { buckets.0.timestamp: 1464739200000}
|
||||
- match: { buckets.0.job_id: farequote }
|
||||
- match: { buckets.0.job_id: jobs-get-result-buckets }
|
||||
- match: { buckets.0.result_type: bucket}
|
||||
|
||||
---
|
||||
|
@ -109,35 +109,35 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
start: "2016-05-01T00:00:00Z"
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
end: "2016-05-01T00:00:00Z"
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
from: "2016-05-01T00:00:00Z"
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
end: "2016-05-01T00:00:00Z"
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
anomaly_score: "80.0"
|
||||
|
||||
|
@ -146,7 +146,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
body:
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
start: "2016-05-01T00:00:00Z"
|
||||
|
@ -154,7 +154,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
body:
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
end: "2016-05-01T00:00:00Z"
|
||||
|
@ -162,7 +162,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
body:
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
from: "2016-05-01T00:00:00Z"
|
||||
|
@ -170,7 +170,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
body:
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
end: "2016-05-01T00:00:00Z"
|
||||
|
@ -178,7 +178,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-buckets"
|
||||
body:
|
||||
timestamp: "2016-06-01T00:00:00Z"
|
||||
anomaly_score: "80.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-get-result-categories
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -15,68 +15,68 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-categories
|
||||
type: category_definition
|
||||
id: farequote-1
|
||||
body: { "job_id": "farequote", "category_id": 1 }
|
||||
id: jobs-get-result-categories-1
|
||||
body: { "job_id": "jobs-get-result-categories", "category_id": 1 }
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-categories
|
||||
type: category_definition
|
||||
id: farequote-2
|
||||
body: { "job_id": "farequote", "category_id": 2 }
|
||||
id: jobs-get-result-categories-2
|
||||
body: { "job_id": "jobs-get-result-categories", "category_id": 2 }
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-unrelated
|
||||
type: category_definition
|
||||
id: farequote-3
|
||||
id: jobs-get-result-categories-3
|
||||
body: { "job_id": "unrelated", "category_id": 1 }
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-categories
|
||||
|
||||
---
|
||||
"Test result categories api":
|
||||
- do:
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
|
||||
- match: { count: 2 }
|
||||
- match: { categories.0.job_id: farequote }
|
||||
- match: { categories.0.job_id: jobs-get-result-categories }
|
||||
- match: { categories.0.category_id: 1 }
|
||||
- match: { categories.1.job_id: farequote }
|
||||
- match: { categories.1.job_id: jobs-get-result-categories }
|
||||
- match: { categories.1.category_id: 2 }
|
||||
|
||||
---
|
||||
"Test get categories with pagination":
|
||||
- do:
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
size: 1
|
||||
|
||||
- length: { categories: 1 }
|
||||
- match: { categories.0.job_id: farequote }
|
||||
- match: { categories.0.job_id: jobs-get-result-categories }
|
||||
- match: { categories.0.category_id: 1 }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
from: 1
|
||||
size: 2
|
||||
|
||||
- length: { categories: 1 }
|
||||
- match: { categories.0.job_id: farequote }
|
||||
- match: { categories.0.job_id: jobs-get-result-categories }
|
||||
- match: { categories.0.category_id: 2 }
|
||||
|
||||
---
|
||||
"Test get category by id":
|
||||
- do:
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
|
||||
- match: { categories.0.job_id: farequote }
|
||||
- match: { categories.0.job_id: jobs-get-result-categories }
|
||||
- match: { categories.0.category_id: 1 }
|
||||
|
||||
---
|
||||
|
@ -84,21 +84,21 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
from: 0
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
size: 1
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
from: 0
|
||||
size: 1
|
||||
|
@ -108,7 +108,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
body:
|
||||
from: 0
|
||||
|
@ -116,7 +116,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
body:
|
||||
size: 1
|
||||
|
@ -124,7 +124,7 @@ setup:
|
|||
- do:
|
||||
catch: request
|
||||
xpack.ml.get_categories:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-categories"
|
||||
category_id: "1"
|
||||
body:
|
||||
from: 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: jobs-get-result-records
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -15,12 +15,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-records
|
||||
type: result
|
||||
id: farequote_1464739200000_1_1
|
||||
id: jobs-get-result-records_1464739200000_1_1
|
||||
body:
|
||||
{
|
||||
"job_id": "farequote",
|
||||
"job_id": "jobs-get-result-records",
|
||||
"result_type": "record",
|
||||
"timestamp": "2016-06-01T00:00:00Z",
|
||||
"record_score": 60.0,
|
||||
|
@ -30,12 +30,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-records
|
||||
type: result
|
||||
id: farequote_1464825600000_1_2
|
||||
id: jobs-get-result-records_1464825600000_1_2
|
||||
body:
|
||||
{
|
||||
"job_id": "farequote",
|
||||
"job_id": "jobs-get-result-records",
|
||||
"result_type": "record",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"record_score": 80.0,
|
||||
|
@ -46,27 +46,27 @@ setup:
|
|||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-jobs-get-result-records
|
||||
|
||||
---
|
||||
"Test result records api":
|
||||
- do:
|
||||
xpack.ml.get_records:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-records"
|
||||
|
||||
- match: { count: 2 }
|
||||
- match: { records.0.timestamp: 1464825600000 }
|
||||
- match: { records.0.job_id: farequote}
|
||||
- match: { records.0.job_id: jobs-get-result-records}
|
||||
- match: { records.0.result_type: record}
|
||||
- match: { records.1.timestamp: 1464739200000 }
|
||||
- match: { records.1.job_id: farequote}
|
||||
- match: { records.1.job_id: jobs-get-result-records}
|
||||
- match: { records.1.result_type: record}
|
||||
|
||||
---
|
||||
"Test get records given exclude_interim is false":
|
||||
- do:
|
||||
xpack.ml.get_records:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-records"
|
||||
exclude_interim: false
|
||||
|
||||
- match: { count: 2 }
|
||||
|
@ -75,7 +75,7 @@ setup:
|
|||
"Test get records given exclude_interim is true":
|
||||
- do:
|
||||
xpack.ml.get_records:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-records"
|
||||
exclude_interim: true
|
||||
|
||||
- match: { count: 1 }
|
||||
|
@ -86,13 +86,13 @@ setup:
|
|||
"Test result records api with time range":
|
||||
- do:
|
||||
xpack.ml.get_records:
|
||||
job_id: "farequote"
|
||||
job_id: "jobs-get-result-records"
|
||||
start: "2016-05-01T00:00:00Z"
|
||||
end: "2016-06-01T01:00:00Z"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { records.0.timestamp: 1464739200000 }
|
||||
- match: { records.0.job_id: farequote}
|
||||
- match: { records.0.job_id: jobs-get-result-records}
|
||||
- match: { records.0.result_type: record}
|
||||
|
||||
---
|
||||
|
|
|
@ -23,10 +23,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: datafeed-job
|
||||
job_id: jobs-get-stats-datafeed-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"jobs-get-stats-datafeed-job",
|
||||
"description":"A job with a datafeed",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -40,14 +40,14 @@ setup:
|
|||
}
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: datafeed-job
|
||||
job_id: jobs-get-stats-datafeed-job
|
||||
|
||||
- do:
|
||||
xpack.ml.put_datafeed:
|
||||
datafeed_id: datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"jobs-get-stats-datafeed-job",
|
||||
"indexes":["farequote"],
|
||||
"types":["response"]
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.get_job_stats:
|
||||
job_id: datafeed-job
|
||||
- match: { jobs.0.job_id : datafeed-job }
|
||||
job_id: jobs-get-stats-datafeed-job
|
||||
- match: { jobs.0.job_id : jobs-get-stats-datafeed-job }
|
||||
- match: { jobs.0.data_counts.processed_record_count: 0 }
|
||||
- match: { jobs.0.model_size_stats.model_bytes : 0 }
|
||||
- match: { jobs.0.state: opened }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"farequote",
|
||||
"job_id":"post-data-job",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -19,10 +19,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: closed_job
|
||||
job_id: post-data-closed-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"closed_job",
|
||||
"job_id":"post-data-closed-job",
|
||||
"description":"A closed job",
|
||||
"analysis_config" : {
|
||||
"detectors" :[{"function":"metric","field_name":"responsetime","by_field_name":"airline"}]
|
||||
|
@ -34,21 +34,21 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
|
||||
---
|
||||
"Test POST data job api, flush, close and verify DataCounts doc":
|
||||
- do:
|
||||
xpack.ml.post_data:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
body:
|
||||
- airline: AAL
|
||||
responsetime: 132.2046
|
||||
sourcetype: farequote
|
||||
sourcetype: post-data-job
|
||||
time: 1403481600
|
||||
- airline: JZA
|
||||
responsetime: 990.4628
|
||||
sourcetype: farequote
|
||||
sourcetype: post-data-job
|
||||
time: 1403481700
|
||||
|
||||
- match: { processed_record_count: 2 }
|
||||
|
@ -64,24 +64,24 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { flushed: true }
|
||||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { closed: true }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_job_stats:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { jobs.0.state: "closed" }
|
||||
|
||||
- do:
|
||||
get:
|
||||
index: .ml-anomalies-farequote
|
||||
index: .ml-anomalies-post-data-job
|
||||
type: data_counts
|
||||
id: farequote-data-counts
|
||||
id: post-data-job-data-counts
|
||||
|
||||
- match: { _source.processed_record_count: 2 }
|
||||
- match: { _source.processed_field_count: 4}
|
||||
|
@ -98,17 +98,17 @@ setup:
|
|||
"Test flush and close job WITHOUT sending any data":
|
||||
- do:
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { flushed: true }
|
||||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { closed: true }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_job_stats:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
- match: { jobs.0.state: "closed" }
|
||||
|
||||
---
|
||||
|
@ -131,7 +131,7 @@ setup:
|
|||
- do:
|
||||
catch: /parse_exception/
|
||||
xpack.ml.post_data:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
reset_start: not_a_date
|
||||
body:
|
||||
- airline: AAL
|
||||
|
@ -146,7 +146,7 @@ setup:
|
|||
- do:
|
||||
catch: /parse_exception/
|
||||
xpack.ml.post_data:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
reset_end: end_not_a_date
|
||||
body:
|
||||
- airline: AAL
|
||||
|
@ -168,19 +168,19 @@ setup:
|
|||
- do:
|
||||
catch: /parse_exception/
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
start: not_a_date
|
||||
|
||||
- do:
|
||||
catch: /parse_exception/
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
end: end_not_a_date
|
||||
|
||||
- do:
|
||||
catch: /parse_exception/
|
||||
xpack.ml.flush_job:
|
||||
job_id: farequote
|
||||
job_id: post-data-job
|
||||
advance_time: advance_time_not_a_date
|
||||
|
||||
---
|
||||
|
@ -201,17 +201,17 @@ setup:
|
|||
- do:
|
||||
catch: /status_exception/
|
||||
xpack.ml.flush_job:
|
||||
job_id: closed_job
|
||||
job_id: post-data-closed-job
|
||||
|
||||
- do:
|
||||
catch: /status_exception/
|
||||
xpack.ml.close_job:
|
||||
job_id: closed_job
|
||||
job_id: post-data-closed-job
|
||||
|
||||
- do:
|
||||
catch: /status_exception/
|
||||
xpack.ml.post_data:
|
||||
job_id: closed_job
|
||||
job_id: post-data-closed-job
|
||||
body:
|
||||
- airline: AAL
|
||||
responsetime: 132.2046
|
||||
|
|
|
@ -76,7 +76,7 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: scroll-job
|
||||
job_id: preview-datafeed-job
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -90,17 +90,17 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_datafeed:
|
||||
datafeed_id: scroll-feed
|
||||
datafeed_id: preview-datafeed-feed
|
||||
body: >
|
||||
{
|
||||
"job_id":"scroll-job",
|
||||
"job_id":"preview-datafeed-job",
|
||||
"indexes":"airline-data",
|
||||
"types":"response"
|
||||
}
|
||||
|
||||
- do:
|
||||
xpack.ml.preview_datafeed:
|
||||
datafeed_id: scroll-feed
|
||||
datafeed_id: preview-datafeed-feed
|
||||
- length: { $body: 4 }
|
||||
- match: { 0.time: 1487376000000 }
|
||||
- match: { 0.airline: foo }
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: foo
|
||||
job_id: revert-model-snapshot
|
||||
body: >
|
||||
{
|
||||
"job_id":"foo",
|
||||
"job_id":"revert-model-snapshot",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -19,20 +19,20 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: foo
|
||||
job_id: revert-model-snapshot
|
||||
|
||||
- do:
|
||||
xpack.ml.close_job:
|
||||
job_id: foo
|
||||
job_id: revert-model-snapshot
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "foo-first"
|
||||
id: "revert-model-snapshot-first"
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "revert-model-snapshot",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"snapshot_id": "first",
|
||||
"description": "first snapshot",
|
||||
|
@ -42,12 +42,12 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "foo-second"
|
||||
id: "revert-model-snapshot-second"
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "revert-model-snapshot",
|
||||
"timestamp": "2016-06-01T00:00:00Z",
|
||||
"snapshot_id": "second",
|
||||
"description": "second snapshot",
|
||||
|
@ -57,49 +57,81 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1464825600000_1"
|
||||
body: { "job_id": "foo", "result_type": "bucket", "timestamp": "2016-06-02T00:00:00Z", "bucket_span":1 }
|
||||
id: "revert-model-snapshot_1464825600000_1"
|
||||
body: >
|
||||
{
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "bucket",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"bucket_span":1
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1464782400000_1"
|
||||
body: { "job_id": "foo", "result_type": "bucket", "timestamp": "2016-06-01T12:00:00Z", "bucket_span":1 }
|
||||
id: "revert-model-snapshot_1464782400000_1"
|
||||
body: >
|
||||
{
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "bucket",
|
||||
"timestamp": "2016-06-01T12:00:00Z",
|
||||
"bucket_span":1
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1462060800000_1"
|
||||
body: { "job_id": "foo", "result_type": "bucket", "timestamp": "2016-05-01T00:00:00Z", "bucket_span":1 }
|
||||
id: "revert-model-snapshot_1462060800000_1"
|
||||
body: >
|
||||
{
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "bucket",
|
||||
"timestamp": "2016-05-01T00:00:00Z",
|
||||
"bucket_span":1
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1464825600000_1_1"
|
||||
body: { "job_id": "foo", "result_type": "record", "timestamp": "2016-06-02T00:00:00Z", "bucket_span":1, "sequence_num":1 }
|
||||
id: "revert-model-snapshot_1464825600000_1_1"
|
||||
body: >
|
||||
{
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "record",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"bucket_span":1,
|
||||
"sequence_num":1
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1462060800000_1_2"
|
||||
body: { "job_id": "foo", "result_type": "record", "timestamp": "2016-05-01T00:00:00Z", "bucket_span":1, "sequence_num":2 }
|
||||
id: "revert-model-snapshot_1462060800000_1_2"
|
||||
body: >
|
||||
{
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "record",
|
||||
"timestamp": "2016-05-01T00:00:00Z",
|
||||
"bucket_span":1,
|
||||
"sequence_num":2
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1464825600000_1_3"
|
||||
id: "revert-model-snapshot_1464825600000_1_3"
|
||||
body: {
|
||||
"job_id": "foo",
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "influencer",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"influencer_field_name": "foo",
|
||||
"influencer_field_name": "revert-model-snapshot",
|
||||
"influencer_field_value": "zoo",
|
||||
"influencer_score": 50.0,
|
||||
"bucket_span": 1,
|
||||
|
@ -108,15 +140,15 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
type: result
|
||||
id: "foo_1462060800000_1_4"
|
||||
id: "revert-model-snapshot_1462060800000_1_4"
|
||||
body:
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "revert-model-snapshot",
|
||||
"result_type": "influencer",
|
||||
"timestamp": "2016-05-01T00:00:00Z",
|
||||
"influencer_field_name": "foo",
|
||||
"influencer_field_name": "revert-model-snapshot",
|
||||
"influencer_field_value": "zoo",
|
||||
"influencer_score": 50.0,
|
||||
"bucket_span": 1,
|
||||
|
@ -125,7 +157,7 @@ setup:
|
|||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
|
@ -136,29 +168,29 @@ setup:
|
|||
- do:
|
||||
catch: /resource_not_found_exception/
|
||||
xpack.ml.revert_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
snapshot_id: "not_exist"
|
||||
|
||||
---
|
||||
"Test revert model with valid snapshotId":
|
||||
- do:
|
||||
xpack.ml.revert_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
snapshot_id: "first"
|
||||
|
||||
- match: { acknowledged: true }
|
||||
- match: { model.job_id: "foo" }
|
||||
- match: { model.job_id: "revert-model-snapshot" }
|
||||
- match: { model.timestamp: 1464825600000 }
|
||||
- match: { model.snapshot_id: "first" }
|
||||
- match: { model.snapshot_doc_count: 0 }
|
||||
|
||||
- do:
|
||||
xpack.ml.revert_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
snapshot_id: "second"
|
||||
|
||||
- match: { acknowledged: true }
|
||||
- match: { model.job_id: "foo" }
|
||||
- match: { model.job_id: "revert-model-snapshot" }
|
||||
- match: { model.timestamp: 1464739200000 }
|
||||
- match: { model.snapshot_id: "second" }
|
||||
- match: { model.snapshot_doc_count: 0 }
|
||||
|
@ -167,7 +199,7 @@ setup:
|
|||
"Test revert model with delete_intervening_results":
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
start: "2016-01-01T00:00:00Z"
|
||||
end: "2016-12-01T00:00:00Z"
|
||||
|
||||
|
@ -175,47 +207,47 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.revert_model_snapshot:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
snapshot_id: "second"
|
||||
delete_intervening_results: true
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-revert-model-snapshot
|
||||
|
||||
- do:
|
||||
xpack.ml.get_buckets:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
start: "2016-01-01T00:00:00Z"
|
||||
end: "2016-12-01T00:00:00Z"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { buckets.0.job_id: "foo" }
|
||||
- match: { buckets.0.job_id: "revert-model-snapshot" }
|
||||
- match: { buckets.0.timestamp: 1462060800000 }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_records:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
start: "2016-01-01T00:00:00Z"
|
||||
end: "2016-12-01T00:00:00Z"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { records.0.job_id: "foo" }
|
||||
- match: { records.0.job_id: "revert-model-snapshot" }
|
||||
- match: { records.0.timestamp: 1462060800000 }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_influencers:
|
||||
job_id: "foo"
|
||||
job_id: "revert-model-snapshot"
|
||||
start: "2016-01-01T00:00:00Z"
|
||||
end: "2016-12-01T01:00:00Z"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { influencers.0.job_id: "foo" }
|
||||
- match: { influencers.0.job_id: "revert-model-snapshot" }
|
||||
- match: { influencers.0.timestamp: 1462060800000 }
|
||||
|
||||
- do:
|
||||
xpack.ml.get_job_stats:
|
||||
job_id: foo
|
||||
job_id: revert-model-snapshot
|
||||
|
||||
- match: { jobs.0.data_counts.latest_record_timestamp: 1464739200000 }
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: datafeed-job
|
||||
job_id: start-stop-datafeed-job
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"start-stop-datafeed-job",
|
||||
"description":"Analysis of response time by airline",
|
||||
"analysis_config" : {
|
||||
"bucket_span": "1h",
|
||||
|
@ -28,10 +28,10 @@ setup:
|
|||
}
|
||||
- do:
|
||||
xpack.ml.put_datafeed:
|
||||
datafeed_id: datafeed-1
|
||||
datafeed_id: start-stop-datafeed-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"job_id":"datafeed-job",
|
||||
"job_id":"start-stop-datafeed-job",
|
||||
"indexes":"airline-data",
|
||||
"types":"response"
|
||||
}
|
||||
|
@ -40,58 +40,58 @@ setup:
|
|||
"Test start and stop datafeed happy path":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
- do:
|
||||
xpack.ml.get_datafeed_stats:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- match: { datafeeds.0.state: started }
|
||||
- do:
|
||||
xpack.ml.stop_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- do:
|
||||
xpack.ml.get_datafeed_stats:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- match: { datafeeds.0.state: stopped }
|
||||
|
||||
---
|
||||
"Test force stop datafeed":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
"datafeed_id": "datafeed-1"
|
||||
"datafeed_id": "start-stop-datafeed-datafeed-1"
|
||||
"start": 0
|
||||
- do:
|
||||
xpack.ml.get_datafeed_stats:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- match: { datafeeds.0.state: started }
|
||||
|
||||
- do:
|
||||
xpack.ml.stop_datafeed:
|
||||
"datafeed_id": "datafeed-1"
|
||||
"datafeed_id": "start-stop-datafeed-datafeed-1"
|
||||
force: true
|
||||
- do:
|
||||
xpack.ml.get_datafeed_stats:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- match: { datafeeds.0.state: stopped }
|
||||
|
||||
---
|
||||
"Test start datafeed given start is now":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: "now"
|
||||
- do:
|
||||
xpack.ml.get_datafeed_stats:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- match: { datafeeds.0.state: started }
|
||||
|
||||
---
|
||||
|
@ -107,33 +107,33 @@ setup:
|
|||
- do:
|
||||
catch: conflict
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
- do:
|
||||
catch: /cannot start datafeed \[datafeed-1\] because job \[datafeed-job\] is not open/
|
||||
catch: /cannot start datafeed \[start-stop-datafeed-datafeed-1\] because job \[start-stop-datafeed-job\] is not open/
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
|
||||
---
|
||||
"Test start already started datafeed job":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
- do:
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
- do:
|
||||
catch: conflict
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
|
||||
- do:
|
||||
catch: /cannot start datafeed \[datafeed-1\] because it has already been started/
|
||||
catch: /cannot start datafeed \[start-stop-datafeed-datafeed-1\] because it has already been started/
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: 0
|
||||
|
||||
---
|
||||
|
@ -148,22 +148,22 @@ setup:
|
|||
- do:
|
||||
catch: conflict
|
||||
xpack.ml.stop_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
- do:
|
||||
catch: /Cannot stop datafeed \[datafeed-1\] because it has already been stopped/
|
||||
catch: /Cannot stop datafeed \[start-stop-datafeed-datafeed-1\] because it has already been stopped/
|
||||
xpack.ml.stop_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
|
||||
---
|
||||
"Test start given end earlier than start":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
|
||||
- do:
|
||||
catch: /.* start \[1485910800000\] must be earlier than end \[1485907200000\]/
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: "2017-02-01T01:00:00Z"
|
||||
end: "2017-02-01T00:00:00Z"
|
||||
|
||||
|
@ -171,12 +171,12 @@ setup:
|
|||
"Test start given end same as start":
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
|
||||
- do:
|
||||
catch: /.* start \[1485910800000\] must be earlier than end \[1485910800000\]/
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
start: "2017-02-01T01:00:00Z"
|
||||
end: "2017-02-01T01:00:00Z"
|
||||
|
||||
|
@ -184,7 +184,7 @@ setup:
|
|||
"Test start given datafeed index does not exist":
|
||||
- do:
|
||||
xpack.ml.update_datafeed:
|
||||
datafeed_id: datafeed-1
|
||||
datafeed_id: start-stop-datafeed-datafeed-1
|
||||
body: >
|
||||
{
|
||||
"indexes":["utopia"]
|
||||
|
@ -192,9 +192,9 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.open_job:
|
||||
job_id: "datafeed-job"
|
||||
job_id: "start-stop-datafeed-job"
|
||||
|
||||
- do:
|
||||
catch: /No node found to start datafeed \[datafeed-1\].*\[utopia\] does not exist.*/
|
||||
catch: /No node found to start datafeed \[start-stop-datafeed-datafeed-1\].*\[utopia\] does not exist.*/
|
||||
xpack.ml.start_datafeed:
|
||||
datafeed_id: "datafeed-1"
|
||||
datafeed_id: "start-stop-datafeed-datafeed-1"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
setup:
|
||||
- do:
|
||||
xpack.ml.put_job:
|
||||
job_id: foo
|
||||
job_id: update-model-snapshot
|
||||
body: >
|
||||
{
|
||||
"analysis_config" : {
|
||||
|
@ -15,40 +15,40 @@ setup:
|
|||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-update-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "1"
|
||||
body: >
|
||||
{
|
||||
"job_id" : "foo",
|
||||
"job_id" : "update-model-snapshot",
|
||||
"timestamp": "2016-06-02T00:00:00Z",
|
||||
"snapshot_id": "foo",
|
||||
"snapshot_id": "snapshot-1",
|
||||
"retain": false
|
||||
}
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-update-model-snapshot
|
||||
type: model_snapshot
|
||||
id: "2"
|
||||
body: >
|
||||
{
|
||||
"job_id": "foo",
|
||||
"job_id": "update-model-snapshot",
|
||||
"timestamp": "2016-06-01T00:00:00Z",
|
||||
"snapshot_id": "bar",
|
||||
"description": "bar",
|
||||
"snapshot_id": "snapshot-2",
|
||||
"description": "snapshot 2 description",
|
||||
"retain": true
|
||||
}
|
||||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-update-model-snapshot
|
||||
|
||||
---
|
||||
"Test with valid description":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
description: "new_description"
|
||||
|
||||
- match: { count: 0 }
|
||||
|
@ -56,8 +56,8 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "foo"
|
||||
snapshot_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
snapshot_id: "snapshot-1"
|
||||
body: >
|
||||
{
|
||||
"description": "new_description"
|
||||
|
@ -69,44 +69,45 @@ setup:
|
|||
|
||||
- do:
|
||||
indices.refresh:
|
||||
index: .ml-anomalies-foo
|
||||
index: .ml-anomalies-update-model-snapshot
|
||||
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
description: "new_description"
|
||||
|
||||
- match: { count: 1 }
|
||||
- match: { model_snapshots.0.snapshot_id: "snapshot-1" }
|
||||
- match: { model_snapshots.0.timestamp: 1464825600000 }
|
||||
|
||||
---
|
||||
"Test with conflict against existing description":
|
||||
- do:
|
||||
xpack.ml.get_model_snapshots:
|
||||
job_id: "foo"
|
||||
description: "bar"
|
||||
job_id: "update-model-snapshot"
|
||||
description: "2"
|
||||
|
||||
- match: { count: 1 }
|
||||
- length: { model_snapshots: 1 }
|
||||
- match: { model_snapshots.0.job_id: "foo" }
|
||||
- match: { model_snapshots.0.description: "bar" }
|
||||
- match: { model_snapshots.0.job_id: "update-model-snapshot" }
|
||||
- match: { model_snapshots.0.description: "snapshot 2 description" }
|
||||
|
||||
- do:
|
||||
catch: request
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "foo"
|
||||
snapshot_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
snapshot_id: "snapshot-1"
|
||||
body: >
|
||||
{
|
||||
"description": "bar"
|
||||
"description": "snapshot"
|
||||
}
|
||||
|
||||
---
|
||||
"Test with retain":
|
||||
- do:
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "foo"
|
||||
snapshot_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
snapshot_id: "snapshot-1"
|
||||
body: >
|
||||
{
|
||||
"retain": true
|
||||
|
@ -117,8 +118,8 @@ setup:
|
|||
|
||||
- do:
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "foo"
|
||||
snapshot_id: "bar"
|
||||
job_id: "update-model-snapshot"
|
||||
snapshot_id: "snapshot-2"
|
||||
body: >
|
||||
{
|
||||
"retain": false
|
||||
|
@ -126,22 +127,22 @@ setup:
|
|||
|
||||
- match: { acknowledged: true }
|
||||
- match: { model.retain: false }
|
||||
- match: { model.description: "bar" }
|
||||
- match: { model.description: "snapshot 2 description" }
|
||||
|
||||
---
|
||||
"Test with all fields":
|
||||
- do:
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "foo"
|
||||
snapshot_id: "foo"
|
||||
job_id: "update-model-snapshot"
|
||||
snapshot_id: "snapshot-1"
|
||||
body: >
|
||||
{
|
||||
"description": "new foo",
|
||||
"description": "new snapshot 1 description",
|
||||
"retain": true
|
||||
}
|
||||
|
||||
- match: { acknowledged: true }
|
||||
- match: { model.description: "new foo" }
|
||||
- match: { model.description: "new snapshot 1 description" }
|
||||
- match: { model.retain: true }
|
||||
|
||||
---
|
||||
|
@ -150,7 +151,7 @@ setup:
|
|||
catch: missing
|
||||
xpack.ml.update_model_snapshot:
|
||||
job_id: "non-existent-job"
|
||||
snapshot_id: "foo"
|
||||
snapshot_id: "san"
|
||||
body: >
|
||||
{
|
||||
"description": "new foo",
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
xpack.ml.validate:
|
||||
body: >
|
||||
{
|
||||
"job_id": "farequote",
|
||||
"job_id": "validate-job-config-with-job-id",
|
||||
"analysis_config": {
|
||||
"bucket_span": "1h",
|
||||
"detectors": [{"function": "metric", "field_name": "responsetime", "by_field_name": "airline"}]
|
||||
|
|
Loading…
Reference in New Issue