[DOCS] Enabled code snippet testing in stop datafeed API (elastic/x-pack-elasticsearch#3127)

Original commit: elastic/x-pack-elasticsearch@282eb587d5
This commit is contained in:
Lisa Cawley 2017-11-27 10:15:46 -08:00 committed by GitHub
parent 5507c46257
commit b5d42c40e4
2 changed files with 57 additions and 4 deletions

View File

@ -77,7 +77,6 @@ buildRestTests.expectedUnconvertedCandidates = [
'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/stop-datafeed.asciidoc',
'en/rest-api/ml/update-datafeed.asciidoc',
'en/rest-api/ml/update-job.asciidoc',
'en/rest-api/ml/update-snapshot.asciidoc',
@ -251,3 +250,55 @@ setups['server_metrics_job'] = '''
}
}
'''
setups['server_metrics_startdf'] = '''
- 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"
- do:
xpack.ml.start_datafeed:
datafeed_id: "datafeed-total-requests"
'''

View File

@ -50,17 +50,17 @@ For more information, see
==== Examples
The following example stops the `datafeed-it-ops-kpi` {dfeed}:
The following example stops the `datafeed-total-requests` {dfeed}:
[source,js]
--------------------------------------------------
POST _xpack/ml/datafeeds/datafeed-it-ops-kpi/_stop
POST _xpack/ml/datafeeds/datafeed-total-requests/_stop
{
"timeout": "30s"
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
// TEST[setup:server_metrics_startdf]
When the {dfeed} stops, you receive the following results:
[source,js]
@ -69,3 +69,5 @@ When the {dfeed} stops, you receive the following results:
"stopped": true
}
----
// CONSOLE
// TESTRESPONSE