[DOCS] Enabled code snippet testing for start datafeed API (elastic/x-pack-elasticsearch#3055)

* [DOCS] Enabled code snippet testing for start datafeed API

* [DOCS] Added datafeed creation to build.gradle

Original commit: elastic/x-pack-elasticsearch@1acb452cf0
This commit is contained in:
Lisa Cawley 2017-11-27 10:57:37 -08:00 committed by GitHub
parent b5d42c40e4
commit a7456cd87d
2 changed files with 53 additions and 3 deletions

View File

@ -76,7 +76,6 @@ buildRestTests.expectedUnconvertedCandidates = [
'en/rest-api/ml/get-record.asciidoc',
'en/rest-api/ml/open-job.asciidoc',
'en/rest-api/ml/preview-datafeed.asciidoc',
'en/rest-api/ml/start-datafeed.asciidoc',
'en/rest-api/ml/update-datafeed.asciidoc',
'en/rest-api/ml/update-job.asciidoc',
'en/rest-api/ml/update-snapshot.asciidoc',
@ -250,6 +249,55 @@ setups['server_metrics_job'] = '''
}
}
'''
setups['server_metrics_openjob'] = '''
- do:
indices.create:
index: server-metrics
body:
settings:
number_of_shards: 1
number_of_replicas: 0
mappings:
metric:
properties:
timestamp:
type: date
total:
type: long
- do:
xpack.ml.put_job:
job_id: "total-requests"
body: >
{
"description" : "Total sum of requests",
"analysis_config" : {
"bucket_span":"10m",
"detectors" :[
{
"detector_description": "Sum of total",
"function": "sum",
"field_name": "total"
}
]},
"data_description" : {
"time_field":"timestamp",
"time_format": "epoch_ms"
}
}
- do:
xpack.ml.put_datafeed:
datafeed_id: "datafeed-total-requests"
body: >
{
"job_id":"total-requests",
"indexes":"server-metrics",
"types":"metric"
}
- do:
xpack.ml.open_job:
job_id: "total-requests"
'''
setups['server_metrics_startdf'] = '''
- do:
indices.create:

View File

@ -84,13 +84,13 @@ The following example starts the `datafeed-it-ops-kpi` {dfeed}:
[source,js]
--------------------------------------------------
POST _xpack/ml/datafeeds/datafeed-it-ops-kpi/_start
POST _xpack/ml/datafeeds/datafeed-total-requests/_start
{
"start": "2017-04-07T18:22:16Z"
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
// TEST[setup:server_metrics_openjob]
When the {dfeed} starts, you receive the following results:
[source,js]
@ -99,3 +99,5 @@ When the {dfeed} starts, you receive the following results:
"started": true
}
----
// CONSOLE
// TESTRESPONSE