diff --git a/x-pack/legacy/plugins/ingest_manager/index.ts b/x-pack/legacy/plugins/ingest_manager/index.ts
index 47c6478f66471..df9923d9f11ec 100644
--- a/x-pack/legacy/plugins/ingest_manager/index.ts
+++ b/x-pack/legacy/plugins/ingest_manager/index.ts
@@ -4,43 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
-import {
- savedObjectMappings,
- OUTPUT_SAVED_OBJECT_TYPE,
- AGENT_CONFIG_SAVED_OBJECT_TYPE,
- DATASOURCE_SAVED_OBJECT_TYPE,
- PACKAGES_SAVED_OBJECT_TYPE,
-} from '../../../plugins/ingest_manager/server';
-
-// TODO https://github.com/elastic/kibana/issues/46373
-// const INDEX_NAMES = {
-// INGEST: '.kibana',
-// };
export function ingestManager(kibana: any) {
return new kibana.Plugin({
id: 'ingestManager',
publicDir: resolve(__dirname, '../../../plugins/ingest_manager/public'),
- uiExports: {
- savedObjectSchemas: {
- [AGENT_CONFIG_SAVED_OBJECT_TYPE]: {
- isNamespaceAgnostic: true,
- // indexPattern: INDEX_NAMES.INGEST,
- },
- [OUTPUT_SAVED_OBJECT_TYPE]: {
- isNamespaceAgnostic: true,
- // indexPattern: INDEX_NAMES.INGEST,
- },
- [DATASOURCE_SAVED_OBJECT_TYPE]: {
- isNamespaceAgnostic: true,
- // indexPattern: INDEX_NAMES.INGEST,
- },
- [PACKAGES_SAVED_OBJECT_TYPE]: {
- isNamespaceAgnostic: true,
- // indexPattern: INDEX_NAMES.INGEST,
- },
- },
- mappings: savedObjectMappings,
- },
});
}
diff --git a/x-pack/plugins/ingest_manager/README.md b/x-pack/plugins/ingest_manager/README.md
index 9cd4821c2a727..0e7abcc3d74a9 100644
--- a/x-pack/plugins/ingest_manager/README.md
+++ b/x-pack/plugins/ingest_manager/README.md
@@ -1,60 +1,70 @@
# Ingest Manager
+
## Plugin
- - The plugin is disabled by default. See the TypeScript type for the [the available plugin configuration options](https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/common/types/index.ts#L9-L27)
- - Setting `xpack.ingestManager.enabled=true` enables the plugin including the EPM and Fleet features. It also adds the `DATASOURCE_API_ROUTES` and `AGENT_CONFIG_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts)
- - Adding `--xpack.ingestManager.epm.enabled=false` will disable the EPM API & UI
- - Adding `--xpack.ingestManager.fleet.enabled=false` will disable the Fleet API & UI
- - [code for adding the routes](https://github.com/elastic/kibana/blob/1f27d349533b1c2865c10c45b2cf705d7416fb36/x-pack/plugins/ingest_manager/server/plugin.ts#L115-L133)
- - [Integration tests](server/integration_tests/router.test.ts)
- - Both EPM and Fleet require `ingestManager` be enabled. They are not standalone features.
+
+- The plugin is disabled by default. See the TypeScript type for the [the available plugin configuration options](https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/common/types/index.ts#L9-L27)
+- Setting `xpack.ingestManager.enabled=true` enables the plugin including the EPM and Fleet features. It also adds the `DATASOURCE_API_ROUTES` and `AGENT_CONFIG_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts)
+- Adding `--xpack.ingestManager.epm.enabled=false` will disable the EPM API & UI
+- Adding `--xpack.ingestManager.fleet.enabled=false` will disable the Fleet API & UI
+ - [code for adding the routes](https://github.com/elastic/kibana/blob/1f27d349533b1c2865c10c45b2cf705d7416fb36/x-pack/plugins/ingest_manager/server/plugin.ts#L115-L133)
+ - [Integration tests](server/integration_tests/router.test.ts)
+- Both EPM and Fleet require `ingestManager` be enabled. They are not standalone features.
## Development
### Getting started
-See the Kibana docs for [how to set up your dev environment](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#setting-up-your-development-environment), [run Elasticsearch](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#running-elasticsearch), and [start Kibana](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#running-kibana)
+See the Kibana docs for [how to set up your dev environment](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#setting-up-your-development-environment), [run Elasticsearch](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#running-elasticsearch), and [start Kibana](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#running-kibana)
One common development workflow is:
- - Bootstrap Kibana
- ```
- yarn kbn bootstrap
- ```
- - Start Elasticsearch in one shell
- ```
- yarn es snapshot -E xpack.security.authc.api_key.enabled=true
- ```
- - Start Kibana in another shell
- ```
- yarn start --xpack.ingestManager.enabled=true --no-base-path --xpack.endpoint.enabled=true
- ```
+
+- Bootstrap Kibana
+ ```
+ yarn kbn bootstrap
+ ```
+- Start Elasticsearch in one shell
+ ```
+ yarn es snapshot -E xpack.security.authc.api_key.enabled=true
+ ```
+- Start Kibana in another shell
+ ```
+ yarn start --xpack.ingestManager.enabled=true --no-base-path --xpack.endpoint.enabled=true
+ ```
This plugin follows the `common`, `server`, `public` structure from the [Architecture Style Guide
](https://github.com/elastic/kibana/blob/master/style_guides/architecture_style_guide.md#file-and-folder-structure). We also follow the pattern of developing feature branches under your personal fork of Kibana.
### API Tests
+
#### Ingest & Fleet
- 1. In one terminal, change to the `x-pack` directory and start the test server with
- ```
- node scripts/functional_tests_server.js --config test/api_integration/config.ts
- ```
-
- 1. in a second terminal, run the tests from the Kibana root directory with
- ```
- node scripts/functional_test_runner.js --config x-pack/test/api_integration/config.ts
- ```
+
+1. In one terminal, change to the `x-pack` directory and start the test server with
+
+ ```
+ node scripts/functional_tests_server.js --config test/api_integration/config.js
+ ```
+
+1. in a second terminal, run the tests from the Kibana root directory with
+ ```
+ node scripts/functional_test_runner.js --config x-pack/test/api_integration/config.js
+ ```
+
#### EPM
- 1. In one terminal, change to the `x-pack` directory and start the test server with
- ```
- node scripts/functional_tests_server.js --config test/epm_api_integration/config.ts
- ```
- 1. in a second terminal, run the tests from the Kibana root directory with
- ```
- node scripts/functional_test_runner.js --config x-pack/test/epm_api_integration/config.ts
- ```
+1. In one terminal, change to the `x-pack` directory and start the test server with
+
+ ```
+ node scripts/functional_tests_server.js --config test/epm_api_integration/config.ts
+ ```
- ### Staying up-to-date with `master`
- While we're developing in the `feature-ingest` feature branch, here's is more information on keeping up to date with upstream kibana.
+1. in a second terminal, run the tests from the Kibana root directory with
+ ```
+ node scripts/functional_test_runner.js --config x-pack/test/epm_api_integration/config.ts
+ ```
+
+### Staying up-to-date with `master`
+
+While we're developing in the `feature-ingest` feature branch, here's is more information on keeping up to date with upstream kibana.
merge upstream master
into feature-ingest
@@ -80,6 +90,7 @@ git push origin
## push your changes to upstream feature branch from the terminal; not GitHub UI
git push upstream
```
+
See https://github.com/elastic/kibana/pull/37950 for an example.
diff --git a/x-pack/plugins/ingest_manager/common/constants/agent.ts b/x-pack/plugins/ingest_manager/common/constants/agent.ts
index 0b462fb4c0319..f3990ba78c539 100644
--- a/x-pack/plugins/ingest_manager/common/constants/agent.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/agent.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export const AGENT_SAVED_OBJECT_TYPE = 'agents';
-export const AGENT_EVENT_SAVED_OBJECT_TYPE = 'agent_events';
-export const AGENT_ACTION_SAVED_OBJECT_TYPE = 'agent_actions';
+export const AGENT_SAVED_OBJECT_TYPE = 'fleet-agents';
+export const AGENT_EVENT_SAVED_OBJECT_TYPE = 'fleet-agent-events';
+export const AGENT_ACTION_SAVED_OBJECT_TYPE = 'fleet-agent-actions';
export const AGENT_TYPE_PERMANENT = 'PERMANENT';
export const AGENT_TYPE_EPHEMERAL = 'EPHEMERAL';
diff --git a/x-pack/plugins/ingest_manager/common/constants/agent_config.ts b/x-pack/plugins/ingest_manager/common/constants/agent_config.ts
index 337022e552278..c5067480fb953 100644
--- a/x-pack/plugins/ingest_manager/common/constants/agent_config.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/agent_config.ts
@@ -5,7 +5,7 @@
*/
import { AgentConfigStatus, DefaultPackages } from '../types';
-export const AGENT_CONFIG_SAVED_OBJECT_TYPE = 'agent_configs';
+export const AGENT_CONFIG_SAVED_OBJECT_TYPE = 'ingest-agent-configs';
export const DEFAULT_AGENT_CONFIG = {
name: 'Default config',
diff --git a/x-pack/plugins/ingest_manager/common/constants/datasource.ts b/x-pack/plugins/ingest_manager/common/constants/datasource.ts
index 0ff472b2afeb0..08113cff53bda 100644
--- a/x-pack/plugins/ingest_manager/common/constants/datasource.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/datasource.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export const DATASOURCE_SAVED_OBJECT_TYPE = 'datasources';
+export const DATASOURCE_SAVED_OBJECT_TYPE = 'ingest-datasources';
diff --git a/x-pack/plugins/ingest_manager/common/constants/enrollment_api_key.ts b/x-pack/plugins/ingest_manager/common/constants/enrollment_api_key.ts
index f4a4bcde2f393..fd28b6632b15c 100644
--- a/x-pack/plugins/ingest_manager/common/constants/enrollment_api_key.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/enrollment_api_key.ts
@@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export const ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE = 'enrollment_api_keys';
+export const ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE = 'fleet-enrollment-api-keys';
diff --git a/x-pack/plugins/ingest_manager/common/constants/epm.ts b/x-pack/plugins/ingest_manager/common/constants/epm.ts
index eb72c28e7bf39..1edf108736e47 100644
--- a/x-pack/plugins/ingest_manager/common/constants/epm.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/epm.ts
@@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/
-export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-package';
+export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-packages';
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = 'index-pattern';
diff --git a/x-pack/plugins/ingest_manager/common/constants/output.ts b/x-pack/plugins/ingest_manager/common/constants/output.ts
index 4c22d0e3fe7a3..ac2d6117be921 100644
--- a/x-pack/plugins/ingest_manager/common/constants/output.ts
+++ b/x-pack/plugins/ingest_manager/common/constants/output.ts
@@ -5,7 +5,7 @@
*/
import { OutputType } from '../types';
-export const OUTPUT_SAVED_OBJECT_TYPE = 'outputs';
+export const OUTPUT_SAVED_OBJECT_TYPE = 'ingest-outputs';
export const DEFAULT_OUTPUT = {
name: 'default',
diff --git a/x-pack/plugins/ingest_manager/common/services/agent_status.ts b/x-pack/plugins/ingest_manager/common/services/agent_status.ts
index 7bbac55f11937..36e6e84b35bfe 100644
--- a/x-pack/plugins/ingest_manager/common/services/agent_status.ts
+++ b/x-pack/plugins/ingest_manager/common/services/agent_status.ts
@@ -8,20 +8,22 @@ import {
AGENT_TYPE_TEMPORARY,
AGENT_POLLING_THRESHOLD_MS,
AGENT_TYPE_PERMANENT,
+ AGENT_SAVED_OBJECT_TYPE,
} from '../constants';
export function buildKueryForOnlineAgents() {
- return `agents.last_checkin >= now-${(3 * AGENT_POLLING_THRESHOLD_MS) / 1000}s`;
+ return `${AGENT_SAVED_OBJECT_TYPE}.last_checkin >= now-${(3 * AGENT_POLLING_THRESHOLD_MS) /
+ 1000}s`;
}
export function buildKueryForOfflineAgents() {
- return `agents.type:${AGENT_TYPE_TEMPORARY} AND agents.last_checkin < now-${(3 *
+ return `${AGENT_SAVED_OBJECT_TYPE}.type:${AGENT_TYPE_TEMPORARY} AND ${AGENT_SAVED_OBJECT_TYPE}.last_checkin < now-${(3 *
AGENT_POLLING_THRESHOLD_MS) /
1000}s`;
}
export function buildKueryForErrorAgents() {
- return `agents.type:${AGENT_TYPE_PERMANENT} AND agents.last_checkin < now-${(4 *
+ return `${AGENT_SAVED_OBJECT_TYPE}.type:${AGENT_TYPE_PERMANENT} AND ${AGENT_SAVED_OBJECT_TYPE}.last_checkin < now-${(4 *
AGENT_POLLING_THRESHOLD_MS) /
1000}s`;
}
diff --git a/x-pack/plugins/ingest_manager/dev_docs/api/agents_list.md b/x-pack/plugins/ingest_manager/dev_docs/api/agents_list.md
index 38f80a8bdc022..fdb54411f8610 100644
--- a/x-pack/plugins/ingest_manager/dev_docs/api/agents_list.md
+++ b/x-pack/plugins/ingest_manager/dev_docs/api/agents_list.md
@@ -18,5 +18,5 @@
## Example
```js
-GET /api/ingest_manager/fleet/agents?kuery=agents.last_checkin:2019-10-01T13:42:54.323Z
+GET /api/ingest_manager/fleet/agents?kuery=fleet-agents.last_checkin:2019-10-01T13:42:54.323Z
```
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/search_bar.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/search_bar.tsx
index 41c24dadba068..4429b9d8e6b82 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/search_bar.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/search_bar.tsx
@@ -8,12 +8,11 @@ import React, { useState, useEffect } from 'react';
import { IFieldType } from 'src/plugins/data/public';
// @ts-ignore
import { EuiSuggest, EuiSuggestItemProps } from '@elastic/eui';
-import { useDebounce } from '../hooks';
-import { useStartDeps } from '../hooks/use_deps';
-import { INDEX_NAME } from '../constants';
+import { useDebounce, useStartDeps } from '../hooks';
+import { INDEX_NAME, AGENT_SAVED_OBJECT_TYPE } from '../constants';
const DEBOUNCE_SEARCH_MS = 150;
-const HIDDEN_FIELDS = ['agents.actions'];
+const HIDDEN_FIELDS = [`${AGENT_SAVED_OBJECT_TYPE}.actions`];
interface Suggestion {
label: string;
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/index.ts b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/index.ts
index 619d03651dd96..e9b736e379b58 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/index.ts
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/constants/index.ts
@@ -3,7 +3,16 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-export { PLUGIN_ID, EPM_API_ROUTES, AGENT_CONFIG_SAVED_OBJECT_TYPE } from '../../../../common';
+export {
+ PLUGIN_ID,
+ EPM_API_ROUTES,
+ AGENT_API_ROUTES,
+ AGENT_CONFIG_SAVED_OBJECT_TYPE,
+ AGENT_EVENT_SAVED_OBJECT_TYPE,
+ AGENT_SAVED_OBJECT_TYPE,
+ ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
+ DATASOURCE_SAVED_OBJECT_TYPE,
+} from '../../../../common';
export const BASE_PATH = '/app/ingestManager';
export const EPM_PATH = '/epm';
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/config_delete_provider.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/config_delete_provider.tsx
index b18349e078766..9ae8369abbd52 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/config_delete_provider.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/config_delete_provider.tsx
@@ -8,6 +8,7 @@ import React, { Fragment, useRef, useState } from 'react';
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
+import { AGENT_SAVED_OBJECT_TYPE } from '../../../constants';
import { sendDeleteAgentConfigs, useCore, sendRequest } from '../../../hooks';
interface Props {
@@ -122,7 +123,7 @@ export const AgentConfigDeleteProvider: React.FunctionComponent = ({ chil
path: `/api/ingest_manager/fleet/agents`,
method: 'get',
query: {
- kuery: `agents.config_id : (${agentConfigsToCheck.join(' or ')})`,
+ kuery: `${AGENT_SAVED_OBJECT_TYPE}.config_id : (${agentConfigsToCheck.join(' or ')})`,
},
});
setAgentsCount(data?.total || 0);
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/datasource_delete_provider.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/datasource_delete_provider.tsx
index 089b0631c2090..df679d33e0324 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/datasource_delete_provider.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/datasource_delete_provider.tsx
@@ -9,8 +9,8 @@ import { EuiCallOut, EuiConfirmModal, EuiOverlayMask, EuiSpacer } from '@elastic
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { useCore, sendRequest, sendDeleteDatasource, useConfig } from '../../../hooks';
-import { AGENT_API_ROUTES } from '../../../../../../common/constants';
-import { AgentConfig } from '../../../../../../common/types/models';
+import { AGENT_API_ROUTES, AGENT_SAVED_OBJECT_TYPE } from '../../../constants';
+import { AgentConfig } from '../../../types';
interface Props {
agentConfig: AgentConfig;
@@ -51,7 +51,7 @@ export const DatasourceDeleteProvider: React.FunctionComponent = ({
query: {
page: 1,
perPage: 1,
- kuery: `agents.config_id : ${agentConfig.id}`,
+ kuery: `${AGENT_SAVED_OBJECT_TYPE}.config_id : ${agentConfig.id}`,
},
});
setAgentsCount(data?.total || 0);
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/epm/screens/detail/settings_panel.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/epm/screens/detail/settings_panel.tsx
index f947466caf4b0..3589a1a9444e1 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/epm/screens/detail/settings_panel.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/epm/screens/detail/settings_panel.tsx
@@ -8,10 +8,11 @@ import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import { EuiSpacer } from '@elastic/eui';
-import { useGetPackageInstallStatus } from '../../hooks';
import { InstallStatus, PackageInfo } from '../../../../types';
-import { InstallationButton } from './installation_button';
import { useGetDatasources } from '../../../../hooks';
+import { DATASOURCE_SAVED_OBJECT_TYPE } from '../../../../constants';
+import { useGetPackageInstallStatus } from '../../hooks';
+import { InstallationButton } from './installation_button';
const NoteLabel = () => (
= ({ ag
-
+
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_list_page/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_list_page/index.tsx
index c79255104a030..23fe18b82468c 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_list_page/index.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/agent_list_page/index.tsx
@@ -40,7 +40,11 @@ import { SearchBar } from '../../../components/search_bar';
import { AgentHealth } from '../components/agent_health';
import { AgentUnenrollProvider } from '../components/agent_unenroll_provider';
import { AgentStatusKueryHelper } from '../../../services';
-import { FLEET_AGENT_DETAIL_PATH, AGENT_CONFIG_DETAILS_PATH } from '../../../constants';
+import {
+ FLEET_AGENT_DETAIL_PATH,
+ AGENT_CONFIG_DETAILS_PATH,
+ AGENT_SAVED_OBJECT_TYPE,
+} from '../../../constants';
const NO_WRAP_TRUNCATE_STYLE: CSSProperties = Object.freeze({
overflow: 'hidden',
@@ -180,7 +184,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
if (kuery) {
kuery = `(${kuery}) and`;
}
- kuery = `${kuery} agents.config_id : (${selectedConfigs
+ kuery = `${kuery} ${AGENT_SAVED_OBJECT_TYPE}.config_id : (${selectedConfigs
.map(config => `"${config}"`)
.join(' or ')})`;
}
@@ -394,7 +398,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
});
setSearch(newSearch);
}}
- fieldPrefix="agents"
+ fieldPrefix={AGENT_SAVED_OBJECT_TYPE}
/>
diff --git a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/enrollment_token_list_page/index.tsx b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/enrollment_token_list_page/index.tsx
index 7520f88215efe..c11e3a49c7693 100644
--- a/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/enrollment_token_list_page/index.tsx
+++ b/x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/fleet/enrollment_token_list_page/index.tsx
@@ -18,6 +18,7 @@ import {
EuiText,
} from '@elastic/eui';
import { FormattedMessage, FormattedDate } from '@kbn/i18n/react';
+import { ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE } from '../../../constants';
import {
usePagination,
useGetEnrollmentAPIKeys,
@@ -29,7 +30,6 @@ import {
import { EnrollmentAPIKey } from '../../../types';
import { SearchBar } from '../../../components/search_bar';
import { NewEnrollmentTokenFlyout } from './components/new_enrollment_key_flyout';
-import {} from '@elastic/eui';
import { ConfirmEnrollmentTokenDelete } from './components/confirm_delete_modal';
const NO_WRAP_TRUNCATE_STYLE: CSSProperties = Object.freeze({
@@ -251,7 +251,7 @@ export const EnrollmentTokenListPage: React.FunctionComponent<{}> = () => {
});
setSearch(newSearch);
}}
- fieldPrefix="enrollment_api_keys"
+ fieldPrefix={ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE}
/>
diff --git a/x-pack/plugins/ingest_manager/server/index.ts b/x-pack/plugins/ingest_manager/server/index.ts
index 851a58f5adac2..2221831b386e9 100644
--- a/x-pack/plugins/ingest_manager/server/index.ts
+++ b/x-pack/plugins/ingest_manager/server/index.ts
@@ -43,13 +43,3 @@ export type IngestManagerConfigType = TypeOf;
export const plugin = (initializerContext: PluginInitializerContext) => {
return new IngestManagerPlugin(initializerContext);
};
-
-// Saved object information bootstrapped by legacy `ingest_manager` plugin
-// TODO: Remove once saved object mappings can be done from NP
-export { savedObjectMappings } from './saved_objects';
-export {
- OUTPUT_SAVED_OBJECT_TYPE,
- AGENT_CONFIG_SAVED_OBJECT_TYPE,
- DATASOURCE_SAVED_OBJECT_TYPE,
- PACKAGES_SAVED_OBJECT_TYPE,
-} from './constants';
diff --git a/x-pack/plugins/ingest_manager/server/plugin.ts b/x-pack/plugins/ingest_manager/server/plugin.ts
index 55aea4b1a4cdd..a92760ce9975e 100644
--- a/x-pack/plugins/ingest_manager/server/plugin.ts
+++ b/x-pack/plugins/ingest_manager/server/plugin.ts
@@ -29,7 +29,7 @@ import {
AGENT_EVENT_SAVED_OBJECT_TYPE,
ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
} from './constants';
-import { registerEncryptedSavedObjects } from './saved_objects';
+import { registerSavedObjects, registerEncryptedSavedObjects } from './saved_objects';
import {
registerEPMRoutes,
registerDatasourceRoutes,
@@ -102,6 +102,7 @@ export class IngestManagerPlugin
this.security = deps.security;
}
+ registerSavedObjects(core.savedObjects);
registerEncryptedSavedObjects(deps.encryptedSavedObjects);
// Register feature
diff --git a/x-pack/plugins/ingest_manager/server/routes/agent_config/handlers.ts b/x-pack/plugins/ingest_manager/server/routes/agent_config/handlers.ts
index 67f758c2c1263..42298960cc615 100644
--- a/x-pack/plugins/ingest_manager/server/routes/agent_config/handlers.ts
+++ b/x-pack/plugins/ingest_manager/server/routes/agent_config/handlers.ts
@@ -8,6 +8,7 @@ import { RequestHandler } from 'src/core/server';
import bluebird from 'bluebird';
import { appContextService, agentConfigService, datasourceService } from '../../services';
import { listAgents } from '../../services/agents';
+import { AGENT_SAVED_OBJECT_TYPE } from '../../constants';
import {
GetAgentConfigsRequestSchema,
GetOneAgentConfigRequestSchema,
@@ -50,7 +51,7 @@ export const getAgentConfigsHandler: RequestHandler<
showInactive: true,
perPage: 0,
page: 1,
- kuery: `agents.config_id:${agentConfig.id}`,
+ kuery: `${AGENT_SAVED_OBJECT_TYPE}.config_id:${agentConfig.id}`,
}).then(({ total: agentTotal }) => (agentConfig.agents = agentTotal)),
{ concurrency: 10 }
);
diff --git a/x-pack/plugins/ingest_manager/server/saved_objects.ts b/x-pack/plugins/ingest_manager/server/saved_objects.ts
index 37a00228443e1..d827fb776b12c 100644
--- a/x-pack/plugins/ingest_manager/server/saved_objects.ts
+++ b/x-pack/plugins/ingest_manager/server/saved_objects.ts
@@ -3,6 +3,9 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
+
+import { SavedObjectsServiceSetup, SavedObjectsType } from 'kibana/server';
+import { EncryptedSavedObjectsPluginSetup } from '../../encrypted_saved_objects/server';
import {
OUTPUT_SAVED_OBJECT_TYPE,
AGENT_CONFIG_SAVED_OBJECT_TYPE,
@@ -13,156 +16,225 @@ import {
AGENT_ACTION_SAVED_OBJECT_TYPE,
ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
} from './constants';
-import { EncryptedSavedObjectsPluginSetup } from '../../encrypted_saved_objects/server';
/*
- * Saved object mappings
+ * Saved object types and mappings
*
* Please update typings in `/common/types` if mappings are updated.
*/
-export const savedObjectMappings = {
+const savedObjectTypes: { [key: string]: SavedObjectsType } = {
[AGENT_SAVED_OBJECT_TYPE]: {
- properties: {
- shared_id: { type: 'keyword' },
- type: { type: 'keyword' },
- active: { type: 'boolean' },
- enrolled_at: { type: 'date' },
- access_api_key_id: { type: 'keyword' },
- version: { type: 'keyword' },
- user_provided_metadata: { type: 'text' },
- local_metadata: { type: 'text' },
- config_id: { type: 'keyword' },
- last_updated: { type: 'date' },
- last_checkin: { type: 'date' },
- config_revision: { type: 'integer' },
- config_newest_revision: { type: 'integer' },
- default_api_key_id: { type: 'keyword' },
- default_api_key: { type: 'keyword' },
- updated_at: { type: 'date' },
- current_error_events: { type: 'text' },
+ name: AGENT_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ shared_id: { type: 'keyword' },
+ type: { type: 'keyword' },
+ active: { type: 'boolean' },
+ enrolled_at: { type: 'date' },
+ access_api_key_id: { type: 'keyword' },
+ version: { type: 'keyword' },
+ user_provided_metadata: { type: 'text' },
+ local_metadata: { type: 'text' },
+ config_id: { type: 'keyword' },
+ last_updated: { type: 'date' },
+ last_checkin: { type: 'date' },
+ config_revision: { type: 'integer' },
+ config_newest_revision: { type: 'integer' },
+ default_api_key_id: { type: 'keyword' },
+ default_api_key: { type: 'keyword' },
+ updated_at: { type: 'date' },
+ current_error_events: { type: 'text' },
+ },
},
},
[AGENT_ACTION_SAVED_OBJECT_TYPE]: {
- properties: {
- agent_id: { type: 'keyword' },
- type: { type: 'keyword' },
- data: { type: 'binary' },
- sent_at: { type: 'date' },
- created_at: { type: 'date' },
+ name: AGENT_ACTION_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ agent_id: { type: 'keyword' },
+ type: { type: 'keyword' },
+ data: { type: 'binary' },
+ sent_at: { type: 'date' },
+ created_at: { type: 'date' },
+ },
},
},
[AGENT_EVENT_SAVED_OBJECT_TYPE]: {
- properties: {
- type: { type: 'keyword' },
- subtype: { type: 'keyword' },
- agent_id: { type: 'keyword' },
- action_id: { type: 'keyword' },
- config_id: { type: 'keyword' },
- stream_id: { type: 'keyword' },
- timestamp: { type: 'date' },
- message: { type: 'text' },
- payload: { type: 'text' },
- data: { type: 'text' },
+ name: AGENT_EVENT_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ type: { type: 'keyword' },
+ subtype: { type: 'keyword' },
+ agent_id: { type: 'keyword' },
+ action_id: { type: 'keyword' },
+ config_id: { type: 'keyword' },
+ stream_id: { type: 'keyword' },
+ timestamp: { type: 'date' },
+ message: { type: 'text' },
+ payload: { type: 'text' },
+ data: { type: 'text' },
+ },
},
},
[AGENT_CONFIG_SAVED_OBJECT_TYPE]: {
- properties: {
- id: { type: 'keyword' },
- name: { type: 'text' },
- is_default: { type: 'boolean' },
- namespace: { type: 'keyword' },
- description: { type: 'text' },
- status: { type: 'keyword' },
- datasources: { type: 'keyword' },
- updated_on: { type: 'keyword' },
- updated_by: { type: 'keyword' },
- revision: { type: 'integer' },
+ name: AGENT_CONFIG_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ id: { type: 'keyword' },
+ name: { type: 'text' },
+ is_default: { type: 'boolean' },
+ namespace: { type: 'keyword' },
+ description: { type: 'text' },
+ status: { type: 'keyword' },
+ datasources: { type: 'keyword' },
+ updated_on: { type: 'keyword' },
+ updated_by: { type: 'keyword' },
+ revision: { type: 'integer' },
+ },
},
},
[ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE]: {
- properties: {
- name: { type: 'keyword' },
- type: { type: 'keyword' },
- api_key: { type: 'binary' },
- api_key_id: { type: 'keyword' },
- config_id: { type: 'keyword' },
- created_at: { type: 'date' },
- updated_at: { type: 'date' },
- expire_at: { type: 'date' },
- active: { type: 'boolean' },
+ name: ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ name: { type: 'keyword' },
+ type: { type: 'keyword' },
+ api_key: { type: 'binary' },
+ api_key_id: { type: 'keyword' },
+ config_id: { type: 'keyword' },
+ created_at: { type: 'date' },
+ updated_at: { type: 'date' },
+ expire_at: { type: 'date' },
+ active: { type: 'boolean' },
+ },
},
},
[OUTPUT_SAVED_OBJECT_TYPE]: {
- properties: {
- name: { type: 'keyword' },
- type: { type: 'keyword' },
- is_default: { type: 'boolean' },
- hosts: { type: 'keyword' },
- ca_sha256: { type: 'keyword' },
- fleet_enroll_username: { type: 'binary' },
- fleet_enroll_password: { type: 'binary' },
- config: { type: 'flattened' },
+ name: OUTPUT_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ name: { type: 'keyword' },
+ type: { type: 'keyword' },
+ is_default: { type: 'boolean' },
+ hosts: { type: 'keyword' },
+ ca_sha256: { type: 'keyword' },
+ fleet_enroll_username: { type: 'binary' },
+ fleet_enroll_password: { type: 'binary' },
+ config: { type: 'flattened' },
+ },
},
},
[DATASOURCE_SAVED_OBJECT_TYPE]: {
- properties: {
- name: { type: 'keyword' },
- description: { type: 'text' },
- namespace: { type: 'keyword' },
- config_id: { type: 'keyword' },
- enabled: { type: 'boolean' },
- package: {
- properties: {
- name: { type: 'keyword' },
- title: { type: 'keyword' },
- version: { type: 'keyword' },
+ name: DATASOURCE_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ name: { type: 'keyword' },
+ description: { type: 'text' },
+ namespace: { type: 'keyword' },
+ config_id: { type: 'keyword' },
+ enabled: { type: 'boolean' },
+ package: {
+ properties: {
+ name: { type: 'keyword' },
+ title: { type: 'keyword' },
+ version: { type: 'keyword' },
+ },
},
- },
- output_id: { type: 'keyword' },
- inputs: {
- type: 'nested',
- properties: {
- type: { type: 'keyword' },
- enabled: { type: 'boolean' },
- processors: { type: 'keyword' },
- config: { type: 'flattened' },
- streams: {
- type: 'nested',
- properties: {
- id: { type: 'keyword' },
- enabled: { type: 'boolean' },
- dataset: { type: 'keyword' },
- processors: { type: 'keyword' },
- config: { type: 'flattened' },
- pkg_stream: { type: 'flattened' },
+ output_id: { type: 'keyword' },
+ inputs: {
+ type: 'nested',
+ properties: {
+ type: { type: 'keyword' },
+ enabled: { type: 'boolean' },
+ processors: { type: 'keyword' },
+ config: { type: 'flattened' },
+ streams: {
+ type: 'nested',
+ properties: {
+ id: { type: 'keyword' },
+ enabled: { type: 'boolean' },
+ dataset: { type: 'keyword' },
+ processors: { type: 'keyword' },
+ config: { type: 'flattened' },
+ pkg_stream: { type: 'flattened' },
+ },
},
},
},
+ revision: { type: 'integer' },
},
- revision: { type: 'integer' },
},
},
[PACKAGES_SAVED_OBJECT_TYPE]: {
- properties: {
- name: { type: 'keyword' },
- version: { type: 'keyword' },
- internal: { type: 'boolean' },
- removable: { type: 'boolean' },
- es_index_patterns: {
- dynamic: false,
- type: 'object',
- },
- installed: {
- type: 'nested',
- properties: {
- id: { type: 'keyword' },
- type: { type: 'keyword' },
+ name: PACKAGES_SAVED_OBJECT_TYPE,
+ hidden: false,
+ namespaceType: 'agnostic',
+ management: {
+ importableAndExportable: false,
+ },
+ mappings: {
+ properties: {
+ name: { type: 'keyword' },
+ version: { type: 'keyword' },
+ internal: { type: 'boolean' },
+ removable: { type: 'boolean' },
+ es_index_patterns: {
+ dynamic: 'false',
+ type: 'object',
+ },
+ installed: {
+ type: 'nested',
+ properties: {
+ id: { type: 'keyword' },
+ type: { type: 'keyword' },
+ },
},
},
},
},
};
+export function registerSavedObjects(savedObjects: SavedObjectsServiceSetup) {
+ Object.values(savedObjectTypes).forEach(type => {
+ savedObjects.registerType(type);
+ });
+}
+
export function registerEncryptedSavedObjects(
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup
) {
diff --git a/x-pack/plugins/ingest_manager/server/services/agent_config.ts b/x-pack/plugins/ingest_manager/server/services/agent_config.ts
index 309ddca3784c2..75bbfc21293c2 100644
--- a/x-pack/plugins/ingest_manager/server/services/agent_config.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agent_config.ts
@@ -67,7 +67,7 @@ class AgentConfigService {
public async ensureDefaultAgentConfig(soClient: SavedObjectsClientContract) {
const configs = await soClient.find({
type: AGENT_CONFIG_SAVED_OBJECT_TYPE,
- filter: 'agent_configs.attributes.is_default:true',
+ filter: `${AGENT_CONFIG_SAVED_OBJECT_TYPE}.attributes.is_default:true`,
});
if (configs.total === 0) {
@@ -244,7 +244,7 @@ class AgentConfigService {
public async getDefaultAgentConfigId(soClient: SavedObjectsClientContract) {
const configs = await soClient.find({
type: AGENT_CONFIG_SAVED_OBJECT_TYPE,
- filter: 'agent_configs.attributes.is_default:true',
+ filter: `${AGENT_CONFIG_SAVED_OBJECT_TYPE}.attributes.is_default:true`,
});
if (configs.saved_objects.length === 0) {
diff --git a/x-pack/plugins/ingest_manager/server/services/agents/acks.test.ts b/x-pack/plugins/ingest_manager/server/services/agents/acks.test.ts
index a8fada00e25da..ae0dedce178a8 100644
--- a/x-pack/plugins/ingest_manager/server/services/agents/acks.test.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agents/acks.test.ts
@@ -14,7 +14,7 @@ import {
AgentActionSOAttributes,
AgentEvent,
} from '../../../common/types/models';
-import { AGENT_TYPE_PERMANENT } from '../../../common/constants';
+import { AGENT_TYPE_PERMANENT, AGENT_ACTION_SAVED_OBJECT_TYPE } from '../../../common/constants';
import { acknowledgeAgentActions } from './acks';
import { appContextService } from '../app_context';
import { IngestManagerAppContext } from '../../plugin';
@@ -31,7 +31,7 @@ describe('test agent acks services', () => {
Promise.resolve({
id: 'action1',
references: [],
- type: 'agent_actions',
+ type: AGENT_ACTION_SAVED_OBJECT_TYPE,
attributes: {
type: 'CONFIG_CHANGE',
agent_id: 'id',
@@ -48,7 +48,7 @@ describe('test agent acks services', () => {
{
id: 'action1',
references: [],
- type: 'agent_actions',
+ type: AGENT_ACTION_SAVED_OBJECT_TYPE,
attributes: {
type: 'CONFIG_CHANGE',
agent_id: 'id',
@@ -137,7 +137,7 @@ describe('test agent acks services', () => {
{
id: 'action1',
references: [],
- type: 'agent_actions',
+ type: AGENT_ACTION_SAVED_OBJECT_TYPE,
attributes: {
type: 'CONFIG_CHANGE',
agent_id: 'id',
diff --git a/x-pack/plugins/ingest_manager/server/services/agents/crud.ts b/x-pack/plugins/ingest_manager/server/services/agents/crud.ts
index ec270884e62b4..175b92b75aca0 100644
--- a/x-pack/plugins/ingest_manager/server/services/agents/crud.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agents/crud.ts
@@ -31,12 +31,17 @@ export async function listAgents(
if (kuery && kuery !== '') {
// To ensure users dont need to know about SO data structure...
- filters.push(kuery.replace(/agents\./g, 'agents.attributes.'));
+ filters.push(
+ kuery.replace(
+ new RegExp(`${AGENT_SAVED_OBJECT_TYPE}\.`, 'g'),
+ `${AGENT_SAVED_OBJECT_TYPE}.attributes.`
+ )
+ );
}
if (showInactive === false) {
- const agentActiveCondition = `agents.attributes.active:true AND not agents.attributes.type:${AGENT_TYPE_EPHEMERAL}`;
- const recentlySeenEphemeralAgent = `agents.attributes.active:true AND agents.attributes.type:${AGENT_TYPE_EPHEMERAL} AND agents.attributes.last_checkin > ${Date.now() -
+ const agentActiveCondition = `${AGENT_SAVED_OBJECT_TYPE}.attributes.active:true AND not ${AGENT_SAVED_OBJECT_TYPE}.attributes.type:${AGENT_TYPE_EPHEMERAL}`;
+ const recentlySeenEphemeralAgent = `${AGENT_SAVED_OBJECT_TYPE}.attributes.active:true AND ${AGENT_SAVED_OBJECT_TYPE}.attributes.type:${AGENT_TYPE_EPHEMERAL} AND ${AGENT_SAVED_OBJECT_TYPE}.attributes.last_checkin > ${Date.now() -
3 * AGENT_POLLING_THRESHOLD_MS}`;
filters.push(`(${agentActiveCondition}) OR (${recentlySeenEphemeralAgent})`);
}
diff --git a/x-pack/plugins/ingest_manager/server/services/agents/events.ts b/x-pack/plugins/ingest_manager/server/services/agents/events.ts
index 707229845531c..2758374eba65f 100644
--- a/x-pack/plugins/ingest_manager/server/services/agents/events.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agents/events.ts
@@ -23,7 +23,10 @@ export async function getAgentEvents(
type: AGENT_EVENT_SAVED_OBJECT_TYPE,
filter:
kuery && kuery !== ''
- ? kuery.replace(/agent_events\./g, 'agent_events.attributes.')
+ ? kuery.replace(
+ new RegExp(`${AGENT_EVENT_SAVED_OBJECT_TYPE}\.`, 'g'),
+ `${AGENT_EVENT_SAVED_OBJECT_TYPE}.attributes.`
+ )
: undefined,
perPage,
page,
diff --git a/x-pack/plugins/ingest_manager/server/services/agents/status.ts b/x-pack/plugins/ingest_manager/server/services/agents/status.ts
index fce989cea3248..c4d4a8436e147 100644
--- a/x-pack/plugins/ingest_manager/server/services/agents/status.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agents/status.ts
@@ -6,7 +6,7 @@
import { SavedObjectsClientContract } from 'src/core/server';
import { getAgent, listAgents } from './crud';
-import { AGENT_EVENT_SAVED_OBJECT_TYPE } from '../../constants';
+import { AGENT_EVENT_SAVED_OBJECT_TYPE, AGENT_SAVED_OBJECT_TYPE } from '../../constants';
import { AgentStatus, Agent } from '../../types';
import {
@@ -72,8 +72,8 @@ export async function getAgentStatusForConfig(
page: 1,
kuery: configId
? kuery
- ? `(${kuery}) and (agents.config_id:"${configId}")`
- : `agents.config_id:"${configId}"`
+ ? `(${kuery}) and (${AGENT_SAVED_OBJECT_TYPE}.config_id:"${configId}")`
+ : `${AGENT_SAVED_OBJECT_TYPE}.config_id:"${configId}"`
: kuery,
})
)
@@ -91,7 +91,9 @@ export async function getAgentStatusForConfig(
async function getEventsCount(soClient: SavedObjectsClientContract, configId?: string) {
const { total } = await soClient.find({
type: AGENT_EVENT_SAVED_OBJECT_TYPE,
- filter: configId ? `agent_events.attributes.config_id:"${configId}"` : undefined,
+ filter: configId
+ ? `${AGENT_EVENT_SAVED_OBJECT_TYPE}.attributes.config_id:"${configId}"`
+ : undefined,
perPage: 0,
page: 1,
sortField: 'timestamp',
diff --git a/x-pack/plugins/ingest_manager/server/services/agents/update.ts b/x-pack/plugins/ingest_manager/server/services/agents/update.ts
index 948e518dff5b4..fd57e83d7421e 100644
--- a/x-pack/plugins/ingest_manager/server/services/agents/update.ts
+++ b/x-pack/plugins/ingest_manager/server/services/agents/update.ts
@@ -22,7 +22,7 @@ export async function updateAgentsForConfigId(
let page = 1;
while (hasMore) {
const { agents } = await listAgents(soClient, {
- kuery: `agents.config_id:"${configId}"`,
+ kuery: `${AGENT_SAVED_OBJECT_TYPE}.config_id:"${configId}"`,
page: page++,
perPage: 1000,
showInactive: true,
@@ -46,7 +46,7 @@ export async function unenrollForConfigId(soClient: SavedObjectsClientContract,
let page = 1;
while (hasMore) {
const { agents } = await listAgents(soClient, {
- kuery: `agents.config_id:"${configId}"`,
+ kuery: `${AGENT_SAVED_OBJECT_TYPE}.config_id:"${configId}"`,
page: page++,
perPage: 1000,
showInactive: true,
diff --git a/x-pack/plugins/ingest_manager/server/services/api_keys/enrollment_api_key.ts b/x-pack/plugins/ingest_manager/server/services/api_keys/enrollment_api_key.ts
index c9ead09b0908d..1ac812c3380cd 100644
--- a/x-pack/plugins/ingest_manager/server/services/api_keys/enrollment_api_key.ts
+++ b/x-pack/plugins/ingest_manager/server/services/api_keys/enrollment_api_key.ts
@@ -31,7 +31,10 @@ export async function listEnrollmentApiKeys(
sortOrder: 'DESC',
filter:
kuery && kuery !== ''
- ? kuery.replace(/enrollment_api_keys\./g, 'enrollment_api_keys.attributes.')
+ ? kuery.replace(
+ new RegExp(`${ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE}\.`, 'g'),
+ `${ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE}.attributes.`
+ )
: undefined,
});
@@ -80,7 +83,7 @@ export async function deleteEnrollmentApiKeyForConfigId(
const { items } = await listEnrollmentApiKeys(soClient, {
page: page++,
perPage: 100,
- kuery: `enrollment_api_keys.config_id:${configId}`,
+ kuery: `${ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE}.config_id:${configId}`,
});
if (items.length === 0) {
diff --git a/x-pack/plugins/ingest_manager/server/services/output.ts b/x-pack/plugins/ingest_manager/server/services/output.ts
index aebb8188db0cc..6c0dce79d550d 100644
--- a/x-pack/plugins/ingest_manager/server/services/output.ts
+++ b/x-pack/plugins/ingest_manager/server/services/output.ts
@@ -14,7 +14,7 @@ class OutputService {
public async ensureDefaultOutput(soClient: SavedObjectsClientContract) {
const outputs = await soClient.find