Skip to content

Commit 4151bd2

Browse files
committed
[DOCS] Moves machine learning APIs to docs folder (#31118)
1 parent 052b04d commit 4151bd2

Some content is hidden

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

56 files changed

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

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-filter.asciidoc renamed to docs/reference/ml/apis/delete-filter.asciidoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[role="xpack"]
2+
[testenv="platinum"]
23
[[ml-delete-filter]]
34
=== Delete Filter API
45
++++
@@ -41,7 +42,7 @@ The following example deletes the `safe_domains` filter:
4142
DELETE _xpack/ml/filters/safe_domains
4243
--------------------------------------------------
4344
// CONSOLE
44-
// TEST[setup:ml_filter_safe_domains]
45+
// TEST[skip:setup:ml_filter_safe_domains]
4546

4647
When the filter is deleted, you receive the following results:
4748
[source,js]
@@ -50,4 +51,4 @@ When the filter is deleted, you receive the following results:
5051
"acknowledged": true
5152
}
5253
----
53-
//TESTRESPONSE
54+
// TESTRESPONSE

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

0 commit comments

Comments
 (0)