Skip to content

Commit b7a63f7

Browse files
authored
[DOCS] Moves machine learning APIs to docs folder (#31118)
1 parent ca94d05 commit b7a63f7

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

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

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)