Skip to content

Commit 4a16d72

Browse files
committed
[DOCS] Moves machine learning APIs to docs folder (#31118)
1 parent 4ad4f51 commit 4a16d72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+390
-158
lines changed

docs/build.gradle

+233-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,20 @@
1919

2020
apply plugin: 'elasticsearch.docs-test'
2121

22-
/* List of files that have snippets that require a gold or platinum licence
23-
and therefore cannot be tested yet... */
22+
/* List of files that have snippets that will not work until platinum tests can occur ... */
2423
buildRestTests.expectedUnconvertedCandidates = [
2524
'reference/ml/transforms.asciidoc',
25+
'reference/ml/apis/delete-calendar-event.asciidoc',
26+
'reference/ml/apis/get-bucket.asciidoc',
27+
'reference/ml/apis/get-category.asciidoc',
28+
'reference/ml/apis/get-influencer.asciidoc',
29+
'reference/ml/apis/get-job-stats.asciidoc',
30+
'reference/ml/apis/get-overall-buckets.asciidoc',
31+
'reference/ml/apis/get-record.asciidoc',
32+
'reference/ml/apis/get-snapshot.asciidoc',
33+
'reference/ml/apis/post-data.asciidoc',
34+
'reference/ml/apis/revert-snapshot.asciidoc',
35+
'reference/ml/apis/update-snapshot.asciidoc',
2636
]
2737

2838
integTestCluster {
@@ -845,3 +855,224 @@ buildRestTests.setups['sensor_prefab_data'] = '''
845855
{"node.terms.value":"c","temperature.sum.value":202.0,"temperature.max.value":202.0,"timestamp.date_histogram.time_zone":"UTC","temperature.min.value":202.0,"timestamp.date_histogram._count":1,"timestamp.date_histogram.interval":"1h","_rollup.computed":["temperature.sum","temperature.min","voltage.avg","temperature.max","node.terms","timestamp.date_histogram"],"voltage.avg.value":4.0,"node.terms._count":1,"_rollup.version":1,"timestamp.date_histogram.timestamp":1516294800000,"voltage.avg._count":1.0,"_rollup.id":"sensor"}
846856
847857
'''
858+
buildRestTests.setups['sample_job'] = '''
859+
- do:
860+
xpack.ml.put_job:
861+
job_id: "sample_job"
862+
body: >
863+
{
864+
"description" : "Very basic job",
865+
"analysis_config" : {
866+
"bucket_span":"10m",
867+
"detectors" :[
868+
{
869+
"function": "count"
870+
}
871+
]},
872+
"data_description" : {
873+
"time_field":"timestamp",
874+
"time_format": "epoch_ms"
875+
}
876+
}
877+
'''
878+
buildRestTests.setups['farequote_index'] = '''
879+
- do:
880+
indices.create:
881+
index: farequote
882+
body:
883+
settings:
884+
number_of_shards: 1
885+
number_of_replicas: 0
886+
mappings:
887+
metric:
888+
properties:
889+
time:
890+
type: date
891+
responsetime:
892+
type: float
893+
airline:
894+
type: keyword
895+
doc_count:
896+
type: integer
897+
'''
898+
buildRestTests.setups['farequote_data'] = buildRestTests.setups['farequote_index'] + '''
899+
- do:
900+
bulk:
901+
index: farequote
902+
type: metric
903+
refresh: true
904+
body: |
905+
{"index": {"_id":"1"}}
906+
{"airline":"JZA","responsetime":990.4628,"time":"2016-02-07T00:00:00+0000", "doc_count": 5}
907+
{"index": {"_id":"2"}}
908+
{"airline":"JBU","responsetime":877.5927,"time":"2016-02-07T00:00:00+0000", "doc_count": 23}
909+
{"index": {"_id":"3"}}
910+
{"airline":"KLM","responsetime":1355.4812,"time":"2016-02-07T00:00:00+0000", "doc_count": 42}
911+
'''
912+
buildRestTests.setups['farequote_job'] = buildRestTests.setups['farequote_data'] + '''
913+
- do:
914+
xpack.ml.put_job:
915+
job_id: "farequote"
916+
body: >
917+
{
918+
"analysis_config": {
919+
"bucket_span": "60m",
920+
"detectors": [{
921+
"function": "mean",
922+
"field_name": "responsetime",
923+
"by_field_name": "airline"
924+
}],
925+
"summary_count_field_name": "doc_count"
926+
},
927+
"data_description": {
928+
"time_field": "time"
929+
}
930+
}
931+
'''
932+
buildRestTests.setups['farequote_datafeed'] = buildRestTests.setups['farequote_job'] + '''
933+
- do:
934+
xpack.ml.put_datafeed:
935+
datafeed_id: "datafeed-farequote"
936+
body: >
937+
{
938+
"job_id":"farequote",
939+
"indexes":"farequote"
940+
}
941+
'''
942+
buildRestTests.setups['server_metrics_index'] = '''
943+
- do:
944+
indices.create:
945+
index: server-metrics
946+
body:
947+
settings:
948+
number_of_shards: 1
949+
number_of_replicas: 0
950+
mappings:
951+
metric:
952+
properties:
953+
timestamp:
954+
type: date
955+
total:
956+
type: long
957+
'''
958+
buildRestTests.setups['server_metrics_data'] = buildRestTests.setups['server_metrics_index'] + '''
959+
- do:
960+
bulk:
961+
index: server-metrics
962+
type: metric
963+
refresh: true
964+
body: |
965+
{"index": {"_id":"1177"}}
966+
{"timestamp":"2017-03-23T13:00:00","total":40476}
967+
{"index": {"_id":"1178"}}
968+
{"timestamp":"2017-03-23T13:00:00","total":15287}
969+
{"index": {"_id":"1179"}}
970+
{"timestamp":"2017-03-23T13:00:00","total":-776}
971+
{"index": {"_id":"1180"}}
972+
{"timestamp":"2017-03-23T13:00:00","total":11366}
973+
{"index": {"_id":"1181"}}
974+
{"timestamp":"2017-03-23T13:00:00","total":3606}
975+
{"index": {"_id":"1182"}}
976+
{"timestamp":"2017-03-23T13:00:00","total":19006}
977+
{"index": {"_id":"1183"}}
978+
{"timestamp":"2017-03-23T13:00:00","total":38613}
979+
{"index": {"_id":"1184"}}
980+
{"timestamp":"2017-03-23T13:00:00","total":19516}
981+
{"index": {"_id":"1185"}}
982+
{"timestamp":"2017-03-23T13:00:00","total":-258}
983+
{"index": {"_id":"1186"}}
984+
{"timestamp":"2017-03-23T13:00:00","total":9551}
985+
{"index": {"_id":"1187"}}
986+
{"timestamp":"2017-03-23T13:00:00","total":11217}
987+
{"index": {"_id":"1188"}}
988+
{"timestamp":"2017-03-23T13:00:00","total":22557}
989+
{"index": {"_id":"1189"}}
990+
{"timestamp":"2017-03-23T13:00:00","total":40508}
991+
{"index": {"_id":"1190"}}
992+
{"timestamp":"2017-03-23T13:00:00","total":11887}
993+
{"index": {"_id":"1191"}}
994+
{"timestamp":"2017-03-23T13:00:00","total":31659}
995+
'''
996+
buildRestTests.setups['server_metrics_job'] = buildRestTests.setups['server_metrics_data'] + '''
997+
- do:
998+
xpack.ml.put_job:
999+
job_id: "total-requests"
1000+
body: >
1001+
{
1002+
"description" : "Total sum of requests",
1003+
"analysis_config" : {
1004+
"bucket_span":"10m",
1005+
"detectors" :[
1006+
{
1007+
"detector_description": "Sum of total",
1008+
"function": "sum",
1009+
"field_name": "total"
1010+
}
1011+
]},
1012+
"data_description" : {
1013+
"time_field":"timestamp",
1014+
"time_format": "epoch_ms"
1015+
}
1016+
}
1017+
'''
1018+
buildRestTests.setups['server_metrics_datafeed'] = buildRestTests.setups['server_metrics_job'] + '''
1019+
- do:
1020+
xpack.ml.put_datafeed:
1021+
datafeed_id: "datafeed-total-requests"
1022+
body: >
1023+
{
1024+
"job_id":"total-requests",
1025+
"indexes":"server-metrics"
1026+
}
1027+
'''
1028+
buildRestTests.setups['server_metrics_openjob'] = buildRestTests.setups['server_metrics_datafeed'] + '''
1029+
- do:
1030+
xpack.ml.open_job:
1031+
job_id: "total-requests"
1032+
'''
1033+
buildRestTests.setups['server_metrics_startdf'] = buildRestTests.setups['server_metrics_openjob'] + '''
1034+
- do:
1035+
xpack.ml.start_datafeed:
1036+
datafeed_id: "datafeed-total-requests"
1037+
'''
1038+
buildRestTests.setups['calendar_outages'] = '''
1039+
- do:
1040+
xpack.ml.put_calendar:
1041+
calendar_id: "planned-outages"
1042+
'''
1043+
buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages'] + '''
1044+
- do:
1045+
xpack.ml.post_calendar_events:
1046+
calendar_id: "planned-outages"
1047+
body: >
1048+
{ "description": "event 1", "start_time": "2017-12-01T00:00:00Z", "end_time": "2017-12-02T00:00:00Z", "calendar_id": "planned-outages" }
1049+
1050+
1051+
'''
1052+
buildRestTests.setups['calendar_outages_openjob'] = buildRestTests.setups['server_metrics_openjob'] + '''
1053+
- do:
1054+
xpack.ml.put_calendar:
1055+
calendar_id: "planned-outages"
1056+
'''
1057+
buildRestTests.setups['calendar_outages_addjob'] = buildRestTests.setups['server_metrics_openjob'] + '''
1058+
- do:
1059+
xpack.ml.put_calendar:
1060+
calendar_id: "planned-outages"
1061+
body: >
1062+
{
1063+
"job_ids": ["total-requests"]
1064+
}
1065+
'''
1066+
buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['calendar_outages_addjob'] + '''
1067+
- do:
1068+
xpack.ml.post_calendar_events:
1069+
calendar_id: "planned-outages"
1070+
body: >
1071+
{ "events" : [
1072+
{ "description": "event 1", "start_time": "1513641600000", "end_time": "1513728000000"},
1073+
{ "description": "event 2", "start_time": "1513814400000", "end_time": "1513900800000"},
1074+
{ "description": "event 3", "start_time": "1514160000000", "end_time": "1514246400000"}
1075+
]}
1076+
'''
1077+
1078+

x-pack/docs/en/rest-api/ml/calendarresource.asciidoc renamed to docs/reference/ml/apis/calendarresource.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-calendar-resource]]
34
=== Calendar Resources
45

x-pack/docs/en/rest-api/ml/close-job.asciidoc renamed to docs/reference/ml/apis/close-job.asciidoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-close-job]]
34
=== Close Jobs API
45
++++
@@ -80,7 +81,7 @@ The following example closes the `total-requests` job:
8081
POST _xpack/ml/anomaly_detectors/total-requests/_close
8182
--------------------------------------------------
8283
// CONSOLE
83-
// TEST[setup:server_metrics_openjob]
84+
// TEST[skip:setup:server_metrics_openjob]
8485

8586
When the job is closed, you receive the following results:
8687
[source,js]

x-pack/docs/en/rest-api/ml/datafeedresource.asciidoc renamed to docs/reference/ml/apis/datafeedresource.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-datafeed-resource]]
34
=== {dfeed-cap} Resources
45

x-pack/docs/en/rest-api/ml/delete-calendar-event.asciidoc renamed to docs/reference/ml/apis/delete-calendar-event.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-calendar-event]]
34
=== Delete Events from Calendar API
45
++++
@@ -44,7 +45,7 @@ calendar:
4445
DELETE _xpack/ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st
4546
--------------------------------------------------
4647
// CONSOLE
47-
// TEST[catch:missing]
48+
// TEST[skip:catch:missing]
4849

4950
When the event is removed, you receive the following results:
5051
[source,js]
@@ -53,4 +54,3 @@ When the event is removed, you receive the following results:
5354
"acknowledged": true
5455
}
5556
----
56-
// NOTCONSOLE

x-pack/docs/en/rest-api/ml/delete-calendar-job.asciidoc renamed to docs/reference/ml/apis/delete-calendar-job.asciidoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-calendar-job]]
34
=== Delete Jobs from Calendar API
45
++++
@@ -38,7 +39,7 @@ calendar and `total-requests` job:
3839
DELETE _xpack/ml/calendars/planned-outages/jobs/total-requests
3940
--------------------------------------------------
4041
// CONSOLE
41-
// TEST[setup:calendar_outages_addjob]
42+
// TEST[skip:setup:calendar_outages_addjob]
4243

4344
When the job is removed from the calendar, you receive the following
4445
results:
@@ -50,4 +51,4 @@ results:
5051
"job_ids": []
5152
}
5253
----
53-
//TESTRESPONSE
54+
// TESTRESPONSE

x-pack/docs/en/rest-api/ml/delete-calendar.asciidoc renamed to docs/reference/ml/apis/delete-calendar.asciidoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-calendar]]
34
=== Delete Calendar API
45
++++
@@ -40,7 +41,7 @@ The following example deletes the `planned-outages` calendar:
4041
DELETE _xpack/ml/calendars/planned-outages
4142
--------------------------------------------------
4243
// CONSOLE
43-
// TEST[setup:calendar_outages]
44+
// TEST[skip:setup:calendar_outages]
4445

4546
When the calendar is deleted, you receive the following results:
4647
[source,js]
@@ -49,4 +50,4 @@ When the calendar is deleted, you receive the following results:
4950
"acknowledged": true
5051
}
5152
----
52-
//TESTRESPONSE
53+
// TESTRESPONSE

x-pack/docs/en/rest-api/ml/delete-datafeed.asciidoc renamed to docs/reference/ml/apis/delete-datafeed.asciidoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-datafeed]]
34
=== Delete {dfeeds-cap} API
45
++++
@@ -47,7 +48,7 @@ The following example deletes the `datafeed-total-requests` {dfeed}:
4748
DELETE _xpack/ml/datafeeds/datafeed-total-requests
4849
--------------------------------------------------
4950
// CONSOLE
50-
// TEST[setup:server_metrics_datafeed]
51+
// TEST[skip:setup:server_metrics_datafeed]
5152

5253
When the {dfeed} is deleted, you receive the following results:
5354
[source,js]

x-pack/docs/en/rest-api/ml/delete-job.asciidoc renamed to docs/reference/ml/apis/delete-job.asciidoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-job]]
34
=== Delete Jobs API
45
++++
@@ -56,7 +57,7 @@ The following example deletes the `total-requests` job:
5657
DELETE _xpack/ml/anomaly_detectors/total-requests
5758
--------------------------------------------------
5859
// CONSOLE
59-
// TEST[setup:server_metrics_job]
60+
// TEST[skip:setup:server_metrics_job]
6061

6162
When the job is deleted, you receive the following results:
6263
[source,js]
@@ -65,4 +66,4 @@ When the job is deleted, you receive the following results:
6566
"acknowledged": true
6667
}
6768
----
68-
// TESTRESPONSE
69+
// TESTRESPONSE

x-pack/docs/en/rest-api/ml/delete-snapshot.asciidoc renamed to docs/reference/ml/apis/delete-snapshot.asciidoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-snapshot]]
34
=== Delete Model Snapshots API
45
++++
@@ -32,7 +33,6 @@ the `model_snapshot_id` in the results from the get jobs API.
3233

3334
You must have `manage_ml`, or `manage` cluster privileges to use this API.
3435
For more information, see {xpack-ref}/security-privileges.html[Security Privileges].
35-
//<<privileges-list-cluster>>.
3636

3737

3838
==== Examples
@@ -53,3 +53,4 @@ When the snapshot is deleted, you receive the following results:
5353
"acknowledged": true
5454
}
5555
----
56+
// TESTRESPONSE

0 commit comments

Comments
 (0)