From e9f000689039c4d5784b6511141de3707677eaa1 Mon Sep 17 00:00:00 2001
From: Jonathan Budzenski
Date: Tue, 29 Jan 2019 13:28:32 -0600
Subject: [PATCH] Remove es _xpack endpoint usage (#29465)
* _xpack/rollup -> _rollup
* _xpack/sql -> _sql
* _xpack/license -> _license
* _xpack/migration -> _migration
* _xpack/watcher -> _watcher
* _xpack/monitoring -> _monitoring
* _xpack/security -> _security
* [console_extensions] regenerate
* [console_extensions] update ml overrides
* [console_extensions] update security overrides
* [console_extensions] update rollup overrides
* Revert "[console_extensions] update rollup overrides"
This reverts commit bb3742570d87bc15528ab0d2d30627d0b4da064a.
* Revert "[console_extensions] update security overrides"
This reverts commit 5c0263b35eedc6afd9e1bc5f399681120066db36.
* Revert "[console_extensions] update ml overrides"
This reverts commit e8254d5671d17f49cdce4c41bc06a49d91b48d13.
* Revert "[console_extensions] regenerate"
This reverts commit 91b754e9562e3165dd91aa693419c45e28471660.
---
.../kbn-test/src/functional_tests/lib/auth.js | 2 +-
.../core_plugins/elasticsearch/index.d.ts | 4 ++--
.../plugins/canvas/server/lib/query_es_sql.js | 2 +-
.../license_management/server/lib/license.js | 2 +-
.../server/lib/start_basic.js | 2 +-
.../server/lib/start_trial.js | 4 ++--
.../public/components/license/index.js | 2 +-
.../kibana_monitoring/lib/monitoring_bulk.js | 4 ++--
.../server/client/elasticsearch_rollup.js | 14 ++++++------
.../server/lib/es_migration_apis.test.ts | 6 ++---
.../server/lib/es_migration_apis.ts | 2 +-
.../elasticsearch_js_plugin.js | 22 +++++++++----------
.../telemetry/local/__tests__/get_xpack.js | 4 ++--
.../server/lib/telemetry/local/get_xpack.js | 6 ++---
14 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/packages/kbn-test/src/functional_tests/lib/auth.js b/packages/kbn-test/src/functional_tests/lib/auth.js
index e8bc4858469d2..0dd4575c64841 100644
--- a/packages/kbn-test/src/functional_tests/lib/auth.js
+++ b/packages/kbn-test/src/functional_tests/lib/auth.js
@@ -94,7 +94,7 @@ async function insertUser(port, auth, username, password, roles = [], retries =
auth,
hostname: 'localhost',
port,
- pathname: `/_xpack/security/user/${username}`,
+ pathname: `/_security/user/${username}`,
}),
json: true,
body: { password, roles },
diff --git a/src/legacy/core_plugins/elasticsearch/index.d.ts b/src/legacy/core_plugins/elasticsearch/index.d.ts
index a744a4cc22e53..8f1a1ca1647f7 100644
--- a/src/legacy/core_plugins/elasticsearch/index.d.ts
+++ b/src/legacy/core_plugins/elasticsearch/index.d.ts
@@ -175,7 +175,7 @@ interface ElasticsearchClientLogging {
}
interface AssistantAPIClientParams extends GenericParams {
- path: '/_xpack/migration/assistance';
+ path: '/_migration/assistance';
method: 'GET';
}
@@ -191,7 +191,7 @@ export interface AssistanceAPIResponse {
}
interface DeprecationAPIClientParams extends GenericParams {
- path: '/_xpack/migration/deprecations';
+ path: '/_migration/deprecations';
method: 'GET';
}
diff --git a/x-pack/plugins/canvas/server/lib/query_es_sql.js b/x-pack/plugins/canvas/server/lib/query_es_sql.js
index 3e84e01756730..84cf1ab4b5b2e 100644
--- a/x-pack/plugins/canvas/server/lib/query_es_sql.js
+++ b/x-pack/plugins/canvas/server/lib/query_es_sql.js
@@ -10,7 +10,7 @@ import { normalizeType } from './normalize_type';
export const queryEsSQL = (elasticsearchClient, { count, query, filter }) =>
elasticsearchClient('transport.request', {
- path: '/_xpack/sql?format=json',
+ path: '/_sql?format=json',
method: 'POST',
body: {
fetch_size: count,
diff --git a/x-pack/plugins/license_management/server/lib/license.js b/x-pack/plugins/license_management/server/lib/license.js
index 8f54317cdb9dc..bc52fe7f56b34 100644
--- a/x-pack/plugins/license_management/server/lib/license.js
+++ b/x-pack/plugins/license_management/server/lib/license.js
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-const getLicensePath = (acknowledge) => `/_xpack/license${ acknowledge ? '?acknowledge=true' : ''}`;
+const getLicensePath = (acknowledge) => `/_license${ acknowledge ? '?acknowledge=true' : ''}`;
export async function putLicense(req, xpackInfo) {
const { acknowledge } = req.query;
diff --git a/x-pack/plugins/license_management/server/lib/start_basic.js b/x-pack/plugins/license_management/server/lib/start_basic.js
index 48170d191cdf8..0924146b70280 100644
--- a/x-pack/plugins/license_management/server/lib/start_basic.js
+++ b/x-pack/plugins/license_management/server/lib/start_basic.js
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-const getStartBasicPath = (acknowledge) => `/_xpack/license/start_basic${ acknowledge ? '?acknowledge=true' : ''}`;
+const getStartBasicPath = (acknowledge) => `/_license/start_basic${ acknowledge ? '?acknowledge=true' : ''}`;
export async function startBasic(req, xpackInfo) {
diff --git a/x-pack/plugins/license_management/server/lib/start_trial.js b/x-pack/plugins/license_management/server/lib/start_trial.js
index ca82596306939..19b702e4e43c4 100644
--- a/x-pack/plugins/license_management/server/lib/start_trial.js
+++ b/x-pack/plugins/license_management/server/lib/start_trial.js
@@ -8,7 +8,7 @@ export async function canStartTrial(req) {
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('admin');
const options = {
method: 'GET',
- path: '/_xpack/license/trial_status'
+ path: '/_license/trial_status'
};
try {
const response = await callWithRequest(req, 'transport.request', options);
@@ -22,7 +22,7 @@ export async function startTrial(req, xpackInfo) {
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('admin');
const options = {
method: 'POST',
- path: '/_xpack/license/start_trial?acknowledge=true'
+ path: '/_license/start_trial?acknowledge=true'
};
try {
/*eslint camelcase: 0*/
diff --git a/x-pack/plugins/monitoring/public/components/license/index.js b/x-pack/plugins/monitoring/public/components/license/index.js
index b8f0de2371b00..a8cf850529fe3 100644
--- a/x-pack/plugins/monitoring/public/components/license/index.js
+++ b/x-pack/plugins/monitoring/public/components/license/index.js
@@ -44,7 +44,7 @@ const LicenseUpdateInfoForRemote = ({ isPrimaryCluster }) => {
- {`curl -XPUT -u 'https://:/_xpack/license' -H 'Content-Type: application/json' -d @license.json`}
+ {`curl -XPUT -u 'https://:/_license' -H 'Content-Type: application/json' -d @license.json`}
);
diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/lib/monitoring_bulk.js b/x-pack/plugins/monitoring/server/kibana_monitoring/lib/monitoring_bulk.js
index bc7d6f9a48d2e..c902fb01f5646 100644
--- a/x-pack/plugins/monitoring/server/kibana_monitoring/lib/monitoring_bulk.js
+++ b/x-pack/plugins/monitoring/server/kibana_monitoring/lib/monitoring_bulk.js
@@ -39,14 +39,14 @@ export function monitoringBulk(Client, _config, components) {
}
},
urls: [{
- fmt: '/_xpack/monitoring/<%=type%>/_bulk',
+ fmt: '/_monitoring/<%=type%>/bulk',
req: {
type: {
type: 'string'
}
}
}, {
- fmt: '/_xpack/monitoring/_bulk'
+ fmt: '/_monitoring/bulk'
}],
needBody: true,
bulkBody: true,
diff --git a/x-pack/plugins/rollup/server/client/elasticsearch_rollup.js b/x-pack/plugins/rollup/server/client/elasticsearch_rollup.js
index 1799f233182f0..af134c12fae22 100644
--- a/x-pack/plugins/rollup/server/client/elasticsearch_rollup.js
+++ b/x-pack/plugins/rollup/server/client/elasticsearch_rollup.js
@@ -13,7 +13,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.rollupIndexCapabilities = ca({
urls: [
{
- fmt: '/<%=indexPattern%>/_xpack/rollup/data',
+ fmt: '/<%=indexPattern%>/_rollup/data',
req: {
indexPattern: {
type: 'string'
@@ -56,7 +56,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.jobs = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/_all',
+ fmt: '/_rollup/job/_all',
}
],
method: 'GET'
@@ -65,7 +65,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.job = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/<%=id%>',
+ fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
@@ -79,7 +79,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.startJob = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/<%=id%>/_start',
+ fmt: '/_rollup/job/<%=id%>/_start',
req: {
id: {
type: 'string'
@@ -93,7 +93,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.stopJob = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/<%=id%>/_stop',
+ fmt: '/_rollup/job/<%=id%>/_stop',
req: {
id: {
type: 'string'
@@ -107,7 +107,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.deleteJob = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/<%=id%>',
+ fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
@@ -121,7 +121,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
rollup.createJob = ca({
urls: [
{
- fmt: '/_xpack/rollup/job/<%=id%>',
+ fmt: '/_rollup/job/<%=id%>',
req: {
id: {
type: 'string'
diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts
index c97f85b3c8a61..5fd06feed9419 100644
--- a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts
+++ b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.test.ts
@@ -14,7 +14,7 @@ describe('getUpgradeAssistantStatus', () => {
let deprecationsResponse: DeprecationAPIResponse;
const callWithRequest = jest.fn().mockImplementation(async (req, api, { path }) => {
- if (path === '/_xpack/migration/deprecations') {
+ if (path === '/_migration/deprecations') {
return deprecationsResponse;
} else {
throw new Error(`Unexpected API call: ${path}`);
@@ -25,10 +25,10 @@ describe('getUpgradeAssistantStatus', () => {
deprecationsResponse = _.cloneDeep(fakeDeprecations);
});
- it('calls /_xpack/migration/deprecations', async () => {
+ it('calls /_migration/deprecations', async () => {
await getUpgradeAssistantStatus(callWithRequest, {} as any, '/');
expect(callWithRequest).toHaveBeenCalledWith({}, 'transport.request', {
- path: '/_xpack/migration/deprecations',
+ path: '/_migration/deprecations',
method: 'GET',
});
});
diff --git a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts
index 0e23314b3648b..0fc4296b552c9 100644
--- a/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts
+++ b/x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts
@@ -31,7 +31,7 @@ export async function getUpgradeAssistantStatus(
basePath: string
): Promise {
const deprecations = (await callWithRequest(req, 'transport.request', {
- path: '/_xpack/migration/deprecations',
+ path: '/_migration/deprecations',
method: 'GET',
})) as DeprecationAPIResponse;
diff --git a/x-pack/plugins/watcher/server/lib/elasticsearch_js_plugin/elasticsearch_js_plugin.js b/x-pack/plugins/watcher/server/lib/elasticsearch_js_plugin/elasticsearch_js_plugin.js
index a0c74bdc45f8f..ad42388beea1e 100644
--- a/x-pack/plugins/watcher/server/lib/elasticsearch_js_plugin/elasticsearch_js_plugin.js
+++ b/x-pack/plugins/watcher/server/lib/elasticsearch_js_plugin/elasticsearch_js_plugin.js
@@ -25,7 +25,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>/_deactivate',
+ fmt: '/_watcher/watch/<%=id%>/_deactivate',
req: {
id: {
type: 'string',
@@ -51,7 +51,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>/_activate',
+ fmt: '/_watcher/watch/<%=id%>/_activate',
req: {
id: {
type: 'string',
@@ -78,7 +78,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>/_ack/<%=action%>',
+ fmt: '/_watcher/watch/<%=id%>/_ack/<%=action%>',
req: {
id: {
type: 'string',
@@ -112,7 +112,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>',
+ fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
@@ -136,7 +136,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/_execute'
+ fmt: '/_watcher/watch/_execute'
},
needBody: true,
method: 'POST'
@@ -151,7 +151,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.getWatch = ca({
params: {},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>',
+ fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
@@ -176,7 +176,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
}
},
url: {
- fmt: '/_xpack/watcher/watch/<%=id%>',
+ fmt: '/_watcher/watch/<%=id%>',
req: {
id: {
type: 'string',
@@ -196,7 +196,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.restart = ca({
params: {},
url: {
- fmt: '/_xpack/watcher/_restart'
+ fmt: '/_watcher/_restart'
},
method: 'PUT'
});
@@ -209,7 +209,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.start = ca({
params: {},
url: {
- fmt: '/_xpack/watcher/_start'
+ fmt: '/_watcher/_start'
},
method: 'PUT'
});
@@ -222,7 +222,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.stats = ca({
params: {},
url: {
- fmt: '/_xpack/watcher/stats'
+ fmt: '/_watcher/stats'
}
});
@@ -234,7 +234,7 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
watcher.stop = ca({
params: {},
url: {
- fmt: '/_xpack/watcher/_stop'
+ fmt: '/_watcher/_stop'
},
method: 'PUT'
});
diff --git a/x-pack/plugins/xpack_main/server/lib/telemetry/local/__tests__/get_xpack.js b/x-pack/plugins/xpack_main/server/lib/telemetry/local/__tests__/get_xpack.js
index 4112f91cb7238..c4cc1fa249a17 100644
--- a/x-pack/plugins/xpack_main/server/lib/telemetry/local/__tests__/get_xpack.js
+++ b/x-pack/plugins/xpack_main/server/lib/telemetry/local/__tests__/get_xpack.js
@@ -18,7 +18,7 @@ import {
function mockGetXPackLicense(callCluster, license) {
callCluster.withArgs('transport.request', {
method: 'GET',
- path: '/_xpack/license',
+ path: '/_license',
query: {
local: 'true'
}
@@ -54,7 +54,7 @@ describe('get_xpack', () => {
describe('getXPackLicense', () => {
- it('uses callCluster to get /_xpack/license API', async () => {
+ it('uses callCluster to get /_license API', async () => {
const response = { type: 'basic' };
const callCluster = sinon.stub();
diff --git a/x-pack/plugins/xpack_main/server/lib/telemetry/local/get_xpack.js b/x-pack/plugins/xpack_main/server/lib/telemetry/local/get_xpack.js
index 3ad1a15b45719..3909741c8c556 100644
--- a/x-pack/plugins/xpack_main/server/lib/telemetry/local/get_xpack.js
+++ b/x-pack/plugins/xpack_main/server/lib/telemetry/local/get_xpack.js
@@ -9,7 +9,7 @@ import { TIMEOUT } from './constants';
/**
* Get the cluster stats from the connected cluster.
*
- * This is the equivalent of GET /_xpack/license?local=true .
+ * This is the equivalent of GET /_license?local=true .
*
* Like any X-Pack related API, X-Pack must installed for this to work.
*
@@ -19,7 +19,7 @@ import { TIMEOUT } from './constants';
export function getXPackLicense(callCluster) {
return callCluster('transport.request', {
method: 'GET',
- path: '/_xpack/license',
+ path: '/_license',
query: {
// Fetching the local license is cheaper than getting it from the master and good enough
local: 'true'
@@ -51,7 +51,7 @@ export function getXPackUsage(callCluster) {
/**
* Combine the X-Pack responses into a single response as Monitoring does already.
*
- * @param {Object} license The license returned from /_xpack/license
+ * @param {Object} license The license returned from /_license
* @param {Object} usage The usage details returned from /_xpack/usage
* @return {Object} An object containing both the license and usage.
*/