diff --git a/x-pack/plugins/uptime/e2e/config.ts b/x-pack/plugins/uptime/e2e/config.ts
index 66b97641b2156..e8af8510fe5dc 100644
--- a/x-pack/plugins/uptime/e2e/config.ts
+++ b/x-pack/plugins/uptime/e2e/config.ts
@@ -26,7 +26,7 @@ async function config({ readConfigFile }: FtrConfigProviderContext) {
const manifestUrl = process.env.SYNTHETICS_SERVICE_MANIFEST ?? kibanaConfig[MANIFEST_KEY];
const serviceUsername = process.env.SYNTHETICS_SERVICE_USERNAME ?? kibanaConfig[SERVICE_USERNAME];
- const servicPassword = process.env.SYNTHETICS_SERVICE_PASSWORD ?? kibanaConfig[SERVICE_PASSWORD];
+ const servicePassword = process.env.SYNTHETICS_SERVICE_PASSWORD ?? kibanaConfig[SERVICE_PASSWORD];
return {
...kibanaCommonTestsConfig.getAll(),
@@ -62,7 +62,7 @@ async function config({ readConfigFile }: FtrConfigProviderContext) {
? serviceUsername
: 'localKibanaIntegrationTestsUser'
}`,
- `--xpack.uptime.service.password=${servicPassword}`,
+ `--xpack.uptime.service.password=${servicePassword}`,
],
},
};
diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts b/x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts
index 5380c611c15cb..192fcf06c3095 100644
--- a/x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts
+++ b/x-pack/plugins/uptime/e2e/journeys/monitor_details.journey.ts
@@ -11,17 +11,22 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
-
-import { journey, step, expect, before, Page } from '@elastic/synthetics';
+import uuid from 'uuid';
+import { journey, step, expect, after, before, Page } from '@elastic/synthetics';
import { monitorManagementPageProvider } from '../page_objects/monitor_management';
journey('MonitorDetails', async ({ page, params }: { page: Page; params: any }) => {
const uptime = monitorManagementPageProvider({ page, kibanaUrl: params.kibanaUrl });
+ const name = `Test monitor ${uuid.v4()}`;
before(async () => {
await uptime.waitForLoadingToFinish();
});
+ after(async () => {
+ await uptime.enableMonitorManagement(false);
+ });
+
step('Go to monitor-management', async () => {
await uptime.navigateToMonitorManagement();
});
@@ -32,13 +37,31 @@ journey('MonitorDetails', async ({ page, params }: { page: Page; params: any })
expect(await invalid.isVisible()).toBeFalsy();
});
+ step('create basic monitor', async () => {
+ await uptime.enableMonitorManagement();
+ await uptime.clickAddMonitor();
+ await uptime.createBasicMonitorDetails({
+ name,
+ locations: ['US Central'],
+ apmServiceName: 'synthetics',
+ });
+ await uptime.fillByTestSubj('syntheticsUrlField', 'https://www.google.com');
+ await uptime.confirmAndSave();
+ });
+
step('navigate to monitor details page', async () => {
- await uptime.assertText({ text: 'Test Monitor' });
- await Promise.all([page.waitForNavigation(), page.click('text="Test Monitor"')]);
- await uptime.assertText({ text: 'Test Monitor' });
+ await uptime.assertText({ text: name });
+ await Promise.all([page.waitForNavigation(), page.click(`text=${name}`)]);
+ await uptime.assertText({ text: name });
const url = await page.textContent('[data-test-subj="monitor-page-url"]');
const type = await page.textContent('[data-test-subj="monitor-page-type"]');
expect(url).toEqual('https://www.google.com(opens in a new tab or window)');
expect(type).toEqual('HTTP');
});
+
+ step('delete monitor', async () => {
+ await uptime.navigateToMonitorManagement();
+ const isSuccessful = await uptime.deleteMonitors();
+ expect(isSuccessful).toBeTruthy();
+ });
});
diff --git a/x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts b/x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts
index 624538244e6d1..a21627548aeb1 100644
--- a/x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts
+++ b/x-pack/plugins/uptime/e2e/journeys/monitor_name.journey.ts
@@ -11,14 +11,24 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
-
+import uuid from 'uuid';
import { journey, step, expect, before, Page } from '@elastic/synthetics';
import { monitorManagementPageProvider } from '../page_objects/monitor_management';
import { byTestId } from './utils';
journey(`MonitorName`, async ({ page, params }: { page: Page; params: any }) => {
+ const name = `Test monitor ${uuid.v4()}`;
const uptime = monitorManagementPageProvider({ page, kibanaUrl: params.kibanaUrl });
+ const createBasicMonitor = async () => {
+ await uptime.createBasicMonitorDetails({
+ name,
+ locations: ['US Central'],
+ apmServiceName: 'synthetics',
+ });
+ await uptime.fillByTestSubj('syntheticsUrlField', 'https://www.google.com');
+ };
+
before(async () => {
await uptime.waitForLoadingToFinish();
});
@@ -33,11 +43,17 @@ journey(`MonitorName`, async ({ page, params }: { page: Page; params: any }) =>
expect(await invalid.isVisible()).toBeFalsy();
});
- step(`shows error if name already exists`, async () => {
+ step('create basic monitor', async () => {
await uptime.enableMonitorManagement();
await uptime.clickAddMonitor();
+ await createBasicMonitor();
+ await uptime.confirmAndSave();
+ });
+
+ step(`shows error if name already exists`, async () => {
+ await uptime.navigateToAddMonitor();
await uptime.createBasicMonitorDetails({
- name: 'Test monitor',
+ name,
locations: ['US Central'],
apmServiceName: 'synthetics',
});
diff --git a/x-pack/plugins/uptime/e2e/playwright_start.ts b/x-pack/plugins/uptime/e2e/playwright_start.ts
index 9108412405602..49ffdd322f1a9 100644
--- a/x-pack/plugins/uptime/e2e/playwright_start.ts
+++ b/x-pack/plugins/uptime/e2e/playwright_start.ts
@@ -13,7 +13,6 @@ import { esArchiverLoad, esArchiverUnload } from './tasks/es_archiver';
import './journeys';
import { createApmAndObsUsersAndRoles } from '../../apm/scripts/create_apm_users_and_roles/create_apm_users_and_roles';
-import { importMonitors } from './tasks/import_monitors';
export function playwrightRunTests({ headless, match }: { headless: boolean; match?: string }) {
return async ({ getService }: any) => {
@@ -44,8 +43,6 @@ async function playwrightStart(getService: any, headless = true, match?: string)
port: config.get('servers.kibana.port'),
});
- await importMonitors({ kibanaUrl });
-
await createApmAndObsUsersAndRoles({
elasticsearch: { username: 'elastic', password: 'changeme' },
kibana: { roleSuffix: 'e2e', hostname: kibanaUrl },
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx
index f1d2d9d470cfe..ccfc1312cbf25 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.test.tsx
@@ -18,7 +18,9 @@ describe('useMonitorName', () => {
expect(result.current).toStrictEqual({ nameAlreadyExists: false, validName: '' });
expect(defaultCore.savedObjects.client.find).toHaveBeenCalledWith({
aggs: {
- monitorNames: { terms: { field: 'synthetics-monitor.attributes.name', size: 10000 } },
+ monitorNames: {
+ terms: { field: 'synthetics-monitor.attributes.name.keyword', size: 10000 },
+ },
},
perPage: 0,
type: 'synthetics-monitor',
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts b/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts
index f37bd94944b92..4c7369c8c31a4 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_config/use_monitor_name.ts
@@ -30,7 +30,7 @@ export const useMonitorName = ({ search = '' }: { search?: string }) => {
const aggs = {
monitorNames: {
terms: {
- field: `${syntheticsMonitorType}.attributes.name`,
+ field: `${syntheticsMonitorType}.attributes.name.keyword`,
size: 10000,
},
},
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx
index bfac60de96bc7..07a3e36f6ca78 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.test.tsx
@@ -28,7 +28,7 @@ describe('', () => {
expect(onPageStateChange).toHaveBeenCalledWith({
pageIndex: 1,
pageSize: 10,
- sortField: 'name',
+ sortField: 'name.keyword',
sortOrder: 'asc',
});
});
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx
index 1aad6d4d888e5..17b7ca839dcd0 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/list_tabs.tsx
@@ -39,7 +39,12 @@ export const MonitorListTabs = ({
useEffect(() => {
setSelectedTabId(viewType);
- onPageStateChange({ pageIndex: 1, pageSize: 10, sortOrder: 'asc', sortField: ConfigKey.NAME });
+ onPageStateChange({
+ pageIndex: 1,
+ pageSize: 10,
+ sortOrder: 'asc',
+ sortField: `${ConfigKey.NAME}.keyword`,
+ });
}, [viewType, onPageStateChange]);
const tabs = [
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx
index 40eb185a65f0c..a641f7a76f3a7 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.test.tsx
@@ -72,7 +72,7 @@ describe('', () => {
const pageState: MonitorManagementListPageState = {
pageIndex: 1,
pageSize: 10,
- sortField: ConfigKey.NAME,
+ sortField: `${ConfigKey.NAME}.keyword`,
sortOrder: 'asc',
};
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx
index 2138c452f8053..6eafc0ae442c1 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list.tsx
@@ -20,7 +20,6 @@ import {
ConfigKey,
FetchMonitorManagementListQueryArgs,
ICMPSimpleFields,
- MonitorFields,
Ping,
ServiceLocations,
EncryptedSyntheticsMonitorWithId,
@@ -39,7 +38,10 @@ import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'
export interface MonitorManagementListPageState {
pageIndex: number;
pageSize: number;
- sortField: keyof MonitorFields;
+ sortField:
+ | `${ConfigKey.URLS}.keyword`
+ | `${ConfigKey.NAME}.keyword`
+ | `${ConfigKey.MONITOR_TYPE}.keyword`;
sortOrder: NonNullable;
}
@@ -86,7 +88,7 @@ export const MonitorManagementList = ({
onPageStateChange({
pageIndex: index + 1, // page index for Saved Objects is base 1
pageSize: size,
- sortField: field as keyof MonitorFields,
+ sortField: `${field}.keyword` as MonitorManagementListPageState['sortField'],
sortOrder: direction,
});
},
@@ -102,7 +104,7 @@ export const MonitorManagementList = ({
const sorting: EuiTableSortingType = {
sort: {
- field: sortField as keyof EncryptedSyntheticsMonitorWithId,
+ field: sortField.replace('.keyword', '') as keyof EncryptedSyntheticsMonitorWithId,
direction: sortOrder,
},
};
diff --git a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx
index 53afdf49c1592..7ca22ad84066b 100644
--- a/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx
+++ b/x-pack/plugins/uptime/public/components/monitor_management/monitor_list/monitor_list_container.tsx
@@ -27,7 +27,7 @@ export const MonitorListContainer: React.FC = () => {
pageIndex: 1, // saved objects page index is base 1
pageSize: 10,
sortOrder: 'asc',
- sortField: ConfigKey.NAME,
+ sortField: `${ConfigKey.NAME}.keyword`,
}
);
diff --git a/x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx b/x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx
index 71785dbaf78ee..15310f352f454 100644
--- a/x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx
+++ b/x-pack/plugins/uptime/public/pages/monitor_management/monitor_management.tsx
@@ -46,7 +46,7 @@ export const MonitorManagementPage: React.FC = () => {
page: 1, // saved objects page index is base 1
perPage: 10,
sortOrder: 'asc',
- sortField: ConfigKey.NAME,
+ sortField: `${ConfigKey.NAME}.keyword`,
})
);
}
diff --git a/x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts b/x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts
index ea20c4c9232e9..ad9bb40dc18d4 100644
--- a/x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts
+++ b/x-pack/plugins/uptime/server/lib/saved_objects/synthetics_monitor.ts
@@ -18,27 +18,36 @@ export const syntheticsMonitor: SavedObjectsType = {
dynamic: false,
properties: {
name: {
- type: 'keyword',
- },
- id: {
- type: 'keyword',
+ type: 'text',
+ fields: {
+ keyword: {
+ type: 'keyword',
+ ignore_above: 256,
+ },
+ },
},
type: {
- type: 'keyword',
+ type: 'text',
+ fields: {
+ keyword: {
+ type: 'keyword',
+ ignore_above: 256,
+ },
+ },
},
urls: {
- type: 'keyword',
- },
- tags: {
- type: 'keyword',
- },
- secrets: {
type: 'text',
+ fields: {
+ keyword: {
+ type: 'keyword',
+ ignore_above: 256,
+ },
+ },
},
},
},
management: {
- importableAndExportable: true,
+ importableAndExportable: false,
icon: 'uptimeApp',
getTitle: (savedObject) =>
savedObject.attributes.name +