mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
[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:
parent
5507c46257
commit
b5d42c40e4
@ -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"
|
||||
|
||||
'''
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user