Skip to content

Commit 9e8cfbb

Browse files
authored
[ML] Deprecate X-Pack centric ML endpoints (#36315)
This commit is part of our plan to deprecate and ultimately remove the use of _xpack in the REST APIs. Relates #35958
1 parent 1d73c17 commit 9e8cfbb

File tree

195 files changed

+1831
-1389
lines changed

Some content is hidden

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

195 files changed

+1831
-1389
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
104104
* format of the response is incompatible i.e. it is not a JSON object.
105105
*/
106106
static shouldAddShardFailureCheck(String path) {
107-
return path.startsWith('_cat') == false && path.startsWith('_xpack/ml/datafeeds/') == false
107+
return path.startsWith('_cat') == false && path.startsWith('_ml/datafeeds/') == false
108108
}
109109

110110
/**

buildSrc/src/test/groovy/org/elasticsearch/gradle/doc/RestTestFromSnippetsTaskTests.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ class RestTestFromSnippetsTaskTests extends GradleUnitTestCase {
5959
void testIsDocWriteRequest() {
6060
assertTrue(shouldAddShardFailureCheck("doc-index/_search"));
6161
assertFalse(shouldAddShardFailureCheck("_cat"))
62-
assertFalse(shouldAddShardFailureCheck("_xpack/ml/datafeeds/datafeed-id/_preview"));
62+
assertFalse(shouldAddShardFailureCheck("_ml/datafeeds/datafeed-id/_preview"));
6363
}
6464
}

client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java

Lines changed: 43 additions & 84 deletions
Large diffs are not rendered by default.

client/rest-high-level/src/test/java/org/elasticsearch/client/MLRequestConvertersTests.java

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

docs/reference/ml/aggregations.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ example:
2424

2525
[source,js]
2626
----------------------------------
27-
PUT _xpack/ml/anomaly_detectors/farequote
27+
PUT _ml/anomaly_detectors/farequote
2828
{
2929
"analysis_config": {
3030
"bucket_span": "60m",
@@ -55,7 +55,7 @@ The aggregations are defined in the {dfeed} as follows:
5555

5656
[source,js]
5757
----------------------------------
58-
PUT _xpack/ml/datafeeds/datafeed-farequote
58+
PUT _ml/datafeeds/datafeed-farequote
5959
{
6060
"job_id":"farequote",
6161
"indices": ["farequote"],

docs/reference/ml/apis/close-job.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ operations, but you can still explore and navigate results.
1515

1616
==== Request
1717

18-
`POST _xpack/ml/anomaly_detectors/<job_id>/_close` +
18+
`POST _ml/anomaly_detectors/<job_id>/_close` +
1919

20-
`POST _xpack/ml/anomaly_detectors/<job_id>,<job_id>/_close` +
20+
`POST _ml/anomaly_detectors/<job_id>,<job_id>/_close` +
2121

22-
`POST _xpack/ml/anomaly_detectors/_all/_close` +
22+
`POST _ml/anomaly_detectors/_all/_close` +
2323

2424

2525
==== Description
@@ -78,7 +78,7 @@ The following example closes the `total-requests` job:
7878

7979
[source,js]
8080
--------------------------------------------------
81-
POST _xpack/ml/anomaly_detectors/total-requests/_close
81+
POST _ml/anomaly_detectors/total-requests/_close
8282
--------------------------------------------------
8383
// CONSOLE
8484
// TEST[skip:setup:server_metrics_openjob]

docs/reference/ml/apis/delete-calendar-event.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes scheduled events from a calendar.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/calendars/<calendar_id>/events/<event_id>`
14+
`DELETE _ml/calendars/<calendar_id>/events/<event_id>`
1515

1616

1717
==== Description
@@ -42,7 +42,7 @@ calendar:
4242

4343
[source,js]
4444
--------------------------------------------------
45-
DELETE _xpack/ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st
45+
DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st
4646
--------------------------------------------------
4747
// CONSOLE
4848
// TEST[skip:catch:missing]

docs/reference/ml/apis/delete-calendar-job.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes jobs from a calendar.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/calendars/<calendar_id>/jobs/<job_id>`
14+
`DELETE _ml/calendars/<calendar_id>/jobs/<job_id>`
1515

1616

1717
==== Path Parameters
@@ -36,7 +36,7 @@ calendar and `total-requests` job:
3636

3737
[source,js]
3838
--------------------------------------------------
39-
DELETE _xpack/ml/calendars/planned-outages/jobs/total-requests
39+
DELETE _ml/calendars/planned-outages/jobs/total-requests
4040
--------------------------------------------------
4141
// CONSOLE
4242
// TEST[skip:setup:calendar_outages_addjob]

docs/reference/ml/apis/delete-calendar.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes a calendar.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/calendars/<calendar_id>`
14+
`DELETE _ml/calendars/<calendar_id>`
1515

1616

1717
==== Description
@@ -38,7 +38,7 @@ The following example deletes the `planned-outages` calendar:
3838

3939
[source,js]
4040
--------------------------------------------------
41-
DELETE _xpack/ml/calendars/planned-outages
41+
DELETE _ml/calendars/planned-outages
4242
--------------------------------------------------
4343
// CONSOLE
4444
// TEST[skip:setup:calendar_outages]

docs/reference/ml/apis/delete-datafeed.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes an existing {dfeed}.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/datafeeds/<feed_id>`
14+
`DELETE _ml/datafeeds/<feed_id>`
1515

1616

1717
==== Description
@@ -45,7 +45,7 @@ The following example deletes the `datafeed-total-requests` {dfeed}:
4545

4646
[source,js]
4747
--------------------------------------------------
48-
DELETE _xpack/ml/datafeeds/datafeed-total-requests
48+
DELETE _ml/datafeeds/datafeed-total-requests
4949
--------------------------------------------------
5050
// CONSOLE
5151
// TEST[skip:setup:server_metrics_datafeed]

docs/reference/ml/apis/delete-expired-data.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Deletes expired and unused machine learning data.
1010

1111
==== Request
1212

13-
`DELETE _xpack/ml/_delete_expired_data`
13+
`DELETE _ml/_delete_expired_data`
1414

1515
==== Description
1616

@@ -32,7 +32,7 @@ The endpoint takes no arguments:
3232

3333
[source,js]
3434
--------------------------------------------------
35-
DELETE _xpack/ml/_delete_expired_data
35+
DELETE _ml/_delete_expired_data
3636
--------------------------------------------------
3737
// CONSOLE
3838
// TEST

docs/reference/ml/apis/delete-filter.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes a filter.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/filters/<filter_id>`
14+
`DELETE _ml/filters/<filter_id>`
1515

1616

1717
==== Description
@@ -39,7 +39,7 @@ The following example deletes the `safe_domains` filter:
3939

4040
[source,js]
4141
--------------------------------------------------
42-
DELETE _xpack/ml/filters/safe_domains
42+
DELETE _ml/filters/safe_domains
4343
--------------------------------------------------
4444
// CONSOLE
4545
// TEST[skip:setup:ml_filter_safe_domains]

docs/reference/ml/apis/delete-forecast.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Deletes forecasts from a {ml} job.
1010

1111
==== Request
1212

13-
`DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast` +
13+
`DELETE _ml/anomaly_detectors/<job_id>/_forecast` +
1414

15-
`DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast/<forecast_id>` +
15+
`DELETE _ml/anomaly_detectors/<job_id>/_forecast/<forecast_id>` +
1616

17-
`DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast/_all`
17+
`DELETE _ml/anomaly_detectors/<job_id>/_forecast/_all`
1818

1919

2020
==== Description
@@ -63,7 +63,7 @@ The following example deletes all forecasts from the `total-requests` job:
6363

6464
[source,js]
6565
--------------------------------------------------
66-
DELETE _xpack/ml/anomaly_detectors/total-requests/_forecast/_all
66+
DELETE _ml/anomaly_detectors/total-requests/_forecast/_all
6767
--------------------------------------------------
6868
// CONSOLE
6969
// TEST[skip:setup:server_metrics_openjob]

docs/reference/ml/apis/delete-job.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes an existing anomaly detection job.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/anomaly_detectors/<job_id>`
14+
`DELETE _ml/anomaly_detectors/<job_id>`
1515

1616

1717
==== Description
@@ -57,7 +57,7 @@ The following example deletes the `total-requests` job:
5757

5858
[source,js]
5959
--------------------------------------------------
60-
DELETE _xpack/ml/anomaly_detectors/total-requests
60+
DELETE _ml/anomaly_detectors/total-requests
6161
--------------------------------------------------
6262
// CONSOLE
6363
// TEST[skip:setup:server_metrics_job]
@@ -75,7 +75,7 @@ In the next example we delete the `total-requests` job asynchronously:
7575

7676
[source,js]
7777
--------------------------------------------------
78-
DELETE _xpack/ml/anomaly_detectors/total-requests?wait_for_completion=false
78+
DELETE _ml/anomaly_detectors/total-requests?wait_for_completion=false
7979
--------------------------------------------------
8080
// CONSOLE
8181
// TEST[skip:setup:server_metrics_job]
@@ -88,4 +88,4 @@ of the job deletion task:
8888
"task": "oTUltX4IQMOUUVeiohTt8A:39"
8989
}
9090
----
91-
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]
91+
// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/]

docs/reference/ml/apis/delete-snapshot.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Deletes an existing model snapshot.
1111

1212
==== Request
1313

14-
`DELETE _xpack/ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>`
14+
`DELETE _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>`
1515

1616

1717
==== Description
@@ -41,7 +41,7 @@ The following example deletes the `1491948163` snapshot:
4141

4242
[source,js]
4343
--------------------------------------------------
44-
DELETE _xpack/ml/anomaly_detectors/farequote/model_snapshots/1491948163
44+
DELETE _ml/anomaly_detectors/farequote/model_snapshots/1491948163
4545
--------------------------------------------------
4646
// CONSOLE
4747
// TEST[skip:todo]
@@ -53,4 +53,4 @@ When the snapshot is deleted, you receive the following results:
5353
"acknowledged": true
5454
}
5555
----
56-
// TESTRESPONSE
56+
// TESTRESPONSE

docs/reference/ml/apis/find-file-structure.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ suitable to be ingested into {es}.
1313

1414
==== Request
1515

16-
`POST _xpack/ml/find_file_structure`
16+
`POST _ml/find_file_structure`
1717

1818

1919
==== Description
@@ -220,7 +220,7 @@ some books. You can send the contents to the `find_file_structure` endpoint:
220220

221221
[source,js]
222222
----
223-
POST _xpack/ml/find_file_structure
223+
POST _ml/find_file_structure
224224
{"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561}
225225
{"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482}
226226
{"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604}
@@ -501,7 +501,7 @@ to match what is specified in the `head` command.
501501

502502
[source,js]
503503
----
504-
curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -20000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&lines_to_sample=20000" -T -
504+
curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -20000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&lines_to_sample=20000" -T -
505505
----
506506
// NOTCONSOLE
507507
// Not converting to console because this shows how curl can be used
@@ -1305,7 +1305,7 @@ analysis:
13051305

13061306
[source,js]
13071307
----
1308-
curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -200000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&lines_to_sample=200000&timeout=1s" -T -
1308+
curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -200000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&lines_to_sample=200000&timeout=1s" -T -
13091309
----
13101310
// NOTCONSOLE
13111311
// Not converting to console because this shows how curl can be used
@@ -1342,7 +1342,7 @@ This is an example of analyzing {es}'s own log file:
13421342

13431343
[source,js]
13441344
----
1345-
curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty" -T "$ES_HOME/logs/elasticsearch.log"
1345+
curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty" -T "$ES_HOME/logs/elasticsearch.log"
13461346
----
13471347
// NOTCONSOLE
13481348
// Not converting to console because this shows how curl can be used
@@ -1496,7 +1496,7 @@ query parameter (appropriately URL escaped):
14961496

14971497
[source,js]
14981498
----
1499-
curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&format=semi_structured_text&grok_pattern=%5C%5B%25%7BTIMESTAMP_ISO8601:timestamp%7D%5C%5D%5C%5B%25%7BLOGLEVEL:loglevel%7D%20*%5C%5D%5C%5B%25%7BJAVACLASS:class%7D%20*%5C%5D%20%5C%5B%25%7BHOSTNAME:node%7D%5C%5D%20%25%7BJAVALOGMESSAGE:message%7D" -T "$ES_HOME/logs/elasticsearch.log"
1499+
curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&format=semi_structured_text&grok_pattern=%5C%5B%25%7BTIMESTAMP_ISO8601:timestamp%7D%5C%5D%5C%5B%25%7BLOGLEVEL:loglevel%7D%20*%5C%5D%5C%5B%25%7BJAVACLASS:class%7D%20*%5C%5D%20%5C%5B%25%7BHOSTNAME:node%7D%5C%5D%20%25%7BJAVALOGMESSAGE:message%7D" -T "$ES_HOME/logs/elasticsearch.log"
15001500
----
15011501
// NOTCONSOLE
15021502
// Not converting to console because this shows how curl can be used

docs/reference/ml/apis/flush-job.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Forces any buffered data to be processed by the job.
1111

1212
==== Request
1313

14-
`POST _xpack/ml/anomaly_detectors/<job_id>/_flush`
14+
`POST _ml/anomaly_detectors/<job_id>/_flush`
1515

1616

1717
==== Description
@@ -69,7 +69,7 @@ The following example flushes the `total-requests` job:
6969

7070
[source,js]
7171
--------------------------------------------------
72-
POST _xpack/ml/anomaly_detectors/total-requests/_flush
72+
POST _ml/anomaly_detectors/total-requests/_flush
7373
{
7474
"calc_interim": true
7575
}
@@ -96,7 +96,7 @@ on January 1, 2018:
9696

9797
[source,js]
9898
--------------------------------------------------
99-
POST _xpack/ml/anomaly_detectors/total-requests/_flush
99+
POST _ml/anomaly_detectors/total-requests/_flush
100100
{
101101
"advance_time": "1514804400"
102102
}

docs/reference/ml/apis/forecast.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Predicts the future behavior of a time series by using its historical behavior.
1010

1111
==== Request
1212

13-
`POST _xpack/ml/anomaly_detectors/<job_id>/_forecast`
13+
`POST _ml/anomaly_detectors/<job_id>/_forecast`
1414

1515

1616
==== Description
@@ -57,7 +57,7 @@ The following example requests a 10 day forecast for the `total-requests` job:
5757

5858
[source,js]
5959
--------------------------------------------------
60-
POST _xpack/ml/anomaly_detectors/total-requests/_forecast
60+
POST _ml/anomaly_detectors/total-requests/_forecast
6161
{
6262
"duration": "10d"
6363
}

docs/reference/ml/apis/get-bucket.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Retrieves job results for one or more buckets.
1111

1212
==== Request
1313

14-
`GET _xpack/ml/anomaly_detectors/<job_id>/results/buckets` +
14+
`GET _ml/anomaly_detectors/<job_id>/results/buckets` +
1515

16-
`GET _xpack/ml/anomaly_detectors/<job_id>/results/buckets/<timestamp>`
16+
`GET _ml/anomaly_detectors/<job_id>/results/buckets/<timestamp>`
1717

1818

1919
==== Description
@@ -90,7 +90,7 @@ The following example gets bucket information for the `it-ops-kpi` job:
9090

9191
[source,js]
9292
--------------------------------------------------
93-
GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/buckets
93+
GET _ml/anomaly_detectors/it-ops-kpi/results/buckets
9494
{
9595
"anomaly_score": 80,
9696
"start": "1454530200001"

docs/reference/ml/apis/get-calendar-event.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ calendars.
1212

1313
==== Request
1414

15-
`GET _xpack/ml/calendars/<calendar_id>/events` +
15+
`GET _ml/calendars/<calendar_id>/events` +
1616

17-
`GET _xpack/ml/calendars/_all/events`
17+
`GET _ml/calendars/_all/events`
1818

1919

2020
===== Description
@@ -64,7 +64,7 @@ The following example gets information about the scheduled events in the
6464

6565
[source,js]
6666
--------------------------------------------------
67-
GET _xpack/ml/calendars/planned-outages/events
67+
GET _ml/calendars/planned-outages/events
6868
--------------------------------------------------
6969
// CONSOLE
7070
// TEST[skip:setup:calendar_outages_addevent]

0 commit comments

Comments
 (0)