readonly string[]
| List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins
. |
| [requiredPlugins](./kibana-plugin-core-server.pluginmanifest.requiredplugins.md) | readonly PluginName[]
| An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. |
| [server](./kibana-plugin-core-server.pluginmanifest.server.md) | boolean
| Specifies whether plugin includes some server-side specific functionality. |
+| [serviceFolders](./kibana-plugin-core-server.pluginmanifest.servicefolders.md) | readonly string[]
| Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections. |
| [ui](./kibana-plugin-core-server.pluginmanifest.ui.md) | boolean
| Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js
file. |
| [version](./kibana-plugin-core-server.pluginmanifest.version.md) | string
| Version of the plugin. |
diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md
new file mode 100644
index 0000000000000..8ee33bdfa0f3f
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PluginManifest](./kibana-plugin-core-server.pluginmanifest.md) > [serviceFolders](./kibana-plugin-core-server.pluginmanifest.servicefolders.md)
+
+## PluginManifest.serviceFolders property
+
+Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections.
+
+Signature:
+
+```typescript
+readonly serviceFolders?: readonly string[];
+```
diff --git a/docs/discover/images/discover-search-for-relevance.png b/docs/discover/images/discover-search-for-relevance.png
new file mode 100644
index 0000000000000..4d59ad186ded4
Binary files /dev/null and b/docs/discover/images/discover-search-for-relevance.png differ
diff --git a/docs/discover/search-for-relevance.asciidoc b/docs/discover/search-for-relevance.asciidoc
new file mode 100644
index 0000000000000..0232c02b6e061
--- /dev/null
+++ b/docs/discover/search-for-relevance.asciidoc
@@ -0,0 +1,24 @@
+[[discover-search-for-relevance]]
+== Search for relevance
+Sometimes you might be unsure which documents best match your question.
+{es} assigns a relevancy, or score to each document, so you can
+can narrow your search to the documents with the most relevant results.
+The higher the score, the better it matches your query.
+
+For example, suppose you have the < extends ExampleClass extends ",
+ Object {
+ "docId": "kibPluginAPluginApi",
+ "pluginId": "pluginA",
+ "scope": "public",
+ "section": "def-public.ExampleClass",
+ "text": "ExampleClass",
+ },
+ "<",
+ Object {
+ "docId": "kibPluginAPluginApi",
+ "pluginId": "pluginA",
+ "scope": "public",
+ "section": "def-public.WithGen",
+ "text": "WithGen",
+ },
+ " >",
+ ]
+ `);
+ expect(linkCount(clss?.signature!)).toBe(3);
+ });
+
+ it('Function with generic inside interface is exported with function type', () => {
+ const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface');
+ expect(exampleInterface).toBeDefined();
+
+ const fnWithGeneric = exampleInterface?.children?.find((c) => c.label === 'aFnWithGen');
+ expect(fnWithGeneric).toBeDefined();
+ expect(fnWithGeneric?.type).toBe(TypeKind.FunctionKind);
+ });
+});
diff --git a/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts b/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts
new file mode 100644
index 0000000000000..9debca91b7ca8
--- /dev/null
+++ b/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts
@@ -0,0 +1,30 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { KibanaPlatformPlugin } from '@kbn/dev-utils';
+import Path from 'path';
+
+export function getKibanaPlatformPlugin(id: string, dir?: string): KibanaPlatformPlugin {
+ const directory = dir ?? Path.resolve(__dirname, '__fixtures__/src/plugin_a');
+ return {
+ manifest: {
+ id,
+ ui: true,
+ server: true,
+ kibanaVersion: '1',
+ version: '1',
+ serviceFolders: [],
+ requiredPlugins: [],
+ requiredBundles: [],
+ optionalPlugins: [],
+ extraPublicDirs: [],
+ },
+ directory,
+ manifestPath: Path.resolve(directory, 'kibana.json'),
+ };
+}
diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json
new file mode 100644
index 0000000000000..db25b8c4f021e
--- /dev/null
+++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json
@@ -0,0 +1 @@
+{"id":"pluginA","client":{"classes":[{"id":"def-public.ExampleClass","type":"Class","label":"ExampleClass","description":[],"signature":[{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.ExampleClass","text":"ExampleClass"}," extends ",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.ExampleClass","text":"ExampleClass"},"<",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.WithGen","text":"WithGen"}," >"],"children":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts","lineNumber":51,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts#L51"},"initialIsOpen":false}],"functions":[{"id":"def-public.notAnArrowFn","type":"Function","label":"notAnArrowFn","signature":["(a: string, b: number | undefined, c: ",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.TypeWithGeneric","text":"TypeWithGeneric"}," {
export interface ExternalServiceComment {
comment: string;
- commentId: string;
+ commentId?: string;
}
export interface MapIncident {
diff --git a/x-pack/plugins/case/server/client/cases/utils.test.ts b/x-pack/plugins/case/server/client/cases/utils.test.ts
index 361d0fb561afd..44e7a682aa7ed 100644
--- a/x-pack/plugins/case/server/client/cases/utils.test.ts
+++ b/x-pack/plugins/case/server/client/cases/utils.test.ts
@@ -17,6 +17,8 @@ import {
basicParams,
userActions,
commentAlert,
+ commentAlertMultipleIds,
+ commentGeneratedAlert,
} from './mock';
import {
@@ -48,7 +50,7 @@ describe('utils', () => {
{
actionType: 'overwrite',
key: 'short_description',
- pipes: ['informationCreated'],
+ pipes: [],
value: 'a title',
},
{
@@ -71,7 +73,7 @@ describe('utils', () => {
{
actionType: 'overwrite',
key: 'short_description',
- pipes: ['myTestPipe'],
+ pipes: [],
value: 'a title',
},
{
@@ -98,7 +100,7 @@ describe('utils', () => {
});
expect(res).toEqual({
- short_description: 'a title (created at 2020-03-13T08:34:53.450Z by Elastic User)',
+ short_description: 'a title',
description: 'a description (created at 2020-03-13T08:34:53.450Z by Elastic User)',
});
});
@@ -122,13 +124,13 @@ describe('utils', () => {
},
fields,
currentIncident: {
- short_description: 'first title (created at 2020-03-13T08:34:53.450Z by Elastic User)',
+ short_description: 'first title',
description: 'first description (created at 2020-03-13T08:34:53.450Z by Elastic User)',
},
});
expect(res).toEqual({
- short_description: 'a title (updated at 2020-03-15T08:34:53.450Z by Another User)',
+ short_description: 'a title',
description:
'first description (created at 2020-03-13T08:34:53.450Z by Elastic User) \r\na description (updated at 2020-03-15T08:34:53.450Z by Another User)',
});
@@ -168,7 +170,7 @@ describe('utils', () => {
});
expect(res).toEqual({
- short_description: 'a title (created at 2020-03-13T08:34:53.450Z by elastic)',
+ short_description: 'a title',
description: 'a description (created at 2020-03-13T08:34:53.450Z by elastic)',
});
});
@@ -190,7 +192,7 @@ describe('utils', () => {
});
expect(res).toEqual({
- short_description: 'a title (updated at 2020-03-15T08:34:53.450Z by anotherUser)',
+ short_description: 'a title',
description: 'a description (updated at 2020-03-15T08:34:53.450Z by anotherUser)',
});
});
@@ -448,8 +450,7 @@ describe('utils', () => {
labels: ['defacement'],
issueType: null,
parent: null,
- short_description:
- 'Super Bad Security Issue (created at 2019-11-25T21:54:48.952Z by elastic)',
+ short_description: 'Super Bad Security Issue',
description:
'This is a brand new case of a bad meanie defacing data (created at 2019-11-25T21:54:48.952Z by elastic)',
externalId: null,
@@ -504,7 +505,7 @@ describe('utils', () => {
expect(res.comments).toEqual([]);
});
- it('it creates comments of type alert correctly', async () => {
+ it('it adds the total alert comments correctly', async () => {
const res = await createIncident({
actionsClient: actionsMock,
theCase: {
@@ -512,7 +513,9 @@ describe('utils', () => {
comments: [
{ ...commentObj, id: 'comment-user-1' },
{ ...commentAlert, id: 'comment-alert-1' },
- { ...commentAlert, id: 'comment-alert-2' },
+ {
+ ...commentAlertMultipleIds,
+ },
],
},
// Remove second push
@@ -536,14 +539,36 @@ describe('utils', () => {
commentId: 'comment-user-1',
},
{
- comment:
- 'Alert with ids alert-id-1 added to case (added at 2019-11-25T21:55:00.177Z by elastic)',
- commentId: 'comment-alert-1',
+ comment: 'Elastic Security Alerts attached to the case: 3',
},
+ ]);
+ });
+
+ it('it removes alerts correctly', async () => {
+ const res = await createIncident({
+ actionsClient: actionsMock,
+ theCase: {
+ ...theCase,
+ comments: [
+ { ...commentObj, id: 'comment-user-1' },
+ commentAlertMultipleIds,
+ commentGeneratedAlert,
+ ],
+ },
+ userActions,
+ connector,
+ mappings,
+ alerts: [],
+ });
+
+ expect(res.comments).toEqual([
{
comment:
- 'Alert with ids alert-id-1 added to case (added at 2019-11-25T21:55:00.177Z by elastic)',
- commentId: 'comment-alert-2',
+ 'Wow, good luck catching that bad meanie! (added at 2019-11-25T21:55:00.177Z by elastic)',
+ commentId: 'comment-user-1',
+ },
+ {
+ comment: 'Elastic Security Alerts attached to the case: 4',
},
]);
});
@@ -578,8 +603,7 @@ describe('utils', () => {
description:
'fun description \r\nThis is a brand new case of a bad meanie defacing data (updated at 2019-11-25T21:54:48.952Z by elastic)',
externalId: 'external-id',
- short_description:
- 'Super Bad Security Issue (updated at 2019-11-25T21:54:48.952Z by elastic)',
+ short_description: 'Super Bad Security Issue',
},
comments: [],
});
diff --git a/x-pack/plugins/case/server/client/cases/utils.ts b/x-pack/plugins/case/server/client/cases/utils.ts
index fda4142bf77c7..a5013d9b93982 100644
--- a/x-pack/plugins/case/server/client/cases/utils.ts
+++ b/x-pack/plugins/case/server/client/cases/utils.ts
@@ -40,6 +40,15 @@ import {
} from './types';
import { getAlertIds } from '../../routes/api/utils';
+interface CreateIncidentArgs {
+ actionsClient: ActionsClient;
+ theCase: CaseResponse;
+ userActions: CaseUserActionsResponse;
+ connector: ActionConnector;
+ mappings: ConnectorMappingsAttributes[];
+ alerts: CaseClientGetAlertsResponse;
+}
+
export const getLatestPushInfo = (
connectorId: string,
userActions: CaseUserActionsResponse
@@ -75,14 +84,13 @@ const getCommentContent = (comment: CommentResponse): string => {
return '';
};
-interface CreateIncidentArgs {
- actionsClient: ActionsClient;
- theCase: CaseResponse;
- userActions: CaseUserActionsResponse;
- connector: ActionConnector;
- mappings: ConnectorMappingsAttributes[];
- alerts: CaseClientGetAlertsResponse;
-}
+const countAlerts = (comments: CaseResponse['comments']): number =>
+ comments?.reduce
+ {localState.configurationValidationError[0].longMessage}
+
+ {localState.expressionBuildError[0].longMessage}
+ visibleErrorMessage