Skip to content

Commit

Permalink
Merge branch 'master' into lens/new-chart-switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 1, 2021
2 parents dc262c3 + c116477 commit 99d5be4
Show file tree
Hide file tree
Showing 371 changed files with 9,714 additions and 5,558 deletions.
2 changes: 1 addition & 1 deletion .bazeliskversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.3
1.7.5
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions docs/discover/search-for-relevance.asciidoc
Original file line number Diff line number Diff line change
@@ -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 <<gs-get-data-into-kibana, sample flights data set>>, and you're a searching for
a flight that arrived or departed from `Warsaw` or `Venice` when the weather was clear.

. In *Discover*, open the index pattern dropdown, and select `kibana_sample_data_flight`.
. In the query bar, click *KQL*, and switch to the <<lucene-query, Lucene query syntax>>.
. Search for `Warsaw OR Venice OR Clear`.
. If you don't see any results, open the time filter and select a time range that contains data.
. From the list of *Available fields*, add `_score` to the document table.
. In the document table, click the header for the `_score` column, and then sort the column by descending scores.
+
The results are currently sorted by first `Time`, and then by `_score`.
. To sort only by `_score`, remove the `Time` field.
+
Your table now shows documents with the best matches, from most to least relevant.
+
[role="screenshot"]
image::images/discover-search-for-relevance.png["Example of a search for relevance"]
4 changes: 2 additions & 2 deletions docs/user/alerting/action-types/pagerduty.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ See <<pagerduty-in-pagerduty, In PagerDuty>> for how to obtain the endpoint and
+
* The action’s type: Trigger, Resolve, or Acknowledge.
* The event’s severity: Info, warning, error, or critical.
* An array of different fields, including the timestamp, group, class, component, and your dedup key.
* An array of different fields, including the timestamp, group, class, component, and your dedup key. By default, the dedup is configured to create a new PagerDuty incident for each alert instance and reuse the incident when a recovered alert instance reactivates.
Depending on your custom needs, assign them variables from the alerting context.
To see the available context variables, click on the *Add alert variable* icon next
to each corresponding field. For more details on these parameters, see the
Expand Down Expand Up @@ -179,7 +179,7 @@ PagerDuty actions have the following properties:

Severity:: The perceived severity of on the affected system. This can be one of `Critical`, `Error`, `Warning` or `Info`(default).
Event action:: One of `Trigger` (default), `Resolve`, or `Acknowledge`. See https://v2.developer.pagerduty.com/docs/events-api-v2#event-action[event action] for more details.
Dedup Key:: All actions sharing this key will be associated with the same PagerDuty alert. This value is used to correlate trigger and resolution. This value is *optional*, and if unset defaults to `action:<action saved object id>`. The maximum length is *255* characters. See https://v2.developer.pagerduty.com/docs/events-api-v2#alert-de-duplication[alert deduplication] for details.
Dedup Key:: All actions sharing this key will be associated with the same PagerDuty alert. This value is used to correlate trigger and resolution. This value is *optional*, and if not set, defaults to `<alert ID>:<alert instance ID>`. The maximum length is *255* characters. See https://v2.developer.pagerduty.com/docs/events-api-v2#alert-de-duplication[alert deduplication] for details.
Timestamp:: An *optional* https://v2.developer.pagerduty.com/v2/docs/types#datetime[ISO-8601 format date-time], indicating the time the event was detected or generated.
Component:: An *optional* value indicating the component of the source machine that is responsible for the event, for example `mysql` or `eth0`.
Group:: An *optional* value indicating the logical grouping of components of a service, for example `app-stack`.
Expand Down
8 changes: 8 additions & 0 deletions docs/user/alerting/alert-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ For domain-specific alerts, refer to the documentation for that app.
* <<geo-alerting, Maps alerts>>
* <<xpack-ml, ML alerts>>

[NOTE]
==============================================
Some alert types are subscription features, while others are free features.
For a comparison of the Elastic subscription levels,
see {subscriptions}[the subscription page].
==============================================


include::stack-alerts/index-threshold.asciidoc[]
include::stack-alerts/es-query.asciidoc[]
include::maps-alerts/geo-alert-types.asciidoc[]
5 changes: 4 additions & 1 deletion docs/user/discover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ image:images/visualize-from-discover.png[Visualization that opens from Discover
[float]
=== What’s next?


* <<kuery-query, Learn more about the structure of a KQL query>>.

* <<kibana-discover-settings, Configure Discover>> to better meet your needs.
Expand All @@ -209,10 +208,14 @@ the table columns that display by default, and more.

* <<reporting-getting-started, Present your findings in a report>>.

* <<discover-search-for-relevance, Search for relevance>>.

--

include::{kib-repo-dir}/management/index-patterns.asciidoc[]

include::{kib-repo-dir}/discover/set-time-filter.asciidoc[]

include::{kib-repo-dir}/discover/search.asciidoc[]

include::{kib-repo-dir}/discover/search-for-relevance.asciidoc[]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@
"fetch-mock": "^7.3.9",
"file-loader": "^4.2.0",
"file-saver": "^1.3.8",
"form-data": "^4.0.0",
"formsy-react": "^1.1.5",
"geckodriver": "^1.21.0",
"glob-watcher": "5.0.3",
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-dev-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export {
KBN_P12_PATH,
KBN_P12_PASSWORD,
} from './certs';
export * from './kbn_client';
export * from './run';
export * from './axios';
export * from './stdio';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export function buildApiDeclaration(
name?: string
): ApiDeclaration {
const apiName = name ? name : isNamedNode(node) ? node.getName() : 'Unnamed';
log.debug(`Building API Declaration for ${apiName} of kind ${node.getKindName()}`);
const apiId = parentApiId ? parentApiId + '.' + apiName : apiName;
const anchorLink: AnchorLink = { scope, pluginName, apiName: apiId };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ export function getArrowFunctionDec(
anchorLink: AnchorLink,
log: ToolingLog
) {
log.debug(
`Getting Arrow Function doc def for node ${node.getName()} of kind ${node.getKindName()}`
);
return {
id: getApiSectionId(anchorLink),
type: TypeKind.FunctionKind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function buildFunctionDec(
const label = Node.isConstructorDeclaration(node)
? 'Constructor'
: node.getName() || '(WARN: Missing name)';
log.debug(`Getting function doc def for node ${label} of kind ${node.getKindName()}`);
return {
id: getApiSectionId(anchorLink),
type: TypeKind.FunctionKind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export function buildVariableDec(
anchorLink: AnchorLink,
log: ToolingLog
): ApiDeclaration {
log.debug('buildVariableDec for ' + node.getName());
const initializer = node.getInitializer();
// Recusively list object properties as children.
if (initializer && Node.isObjectLiteralExpression(initializer)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

import { REPO_ROOT } from '@kbn/utils';
import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils';
import { getPluginApiDocId } from '../utils';
import { extractImportReferences } from './extract_import_refs';
Expand Down Expand Up @@ -82,7 +83,43 @@ it('test extractImportReference with unknown imports', () => {
expect(results.length).toBe(3);
expect(results[0]).toBe('<I extends ');
expect(results[1]).toBe('FooFoo');
expect(results[2]).toBe('>');
});

it('test full file imports with no matching plugin', () => {
const refs = extractImportReferences(
`typeof import("${REPO_ROOT}/src/plugins/data/common/es_query/kuery/node_types/function")`,
plugins,
log
);
expect(refs).toMatchInlineSnapshot(`
Array [
"typeof ",
"src/plugins/data/common/es_query/kuery/node_types/function",
]
`);
expect(refs.length).toBe(2);
});

it('test full file imports with a matching plugin', () => {
const refs = extractImportReferences(
`typeof import("${plugin.directory}/public/foo/index") something`,
plugins,
log
);
expect(refs).toMatchInlineSnapshot(`
Array [
"typeof ",
Object {
"docId": "kibPluginAPluginApi",
"pluginId": "pluginA",
"scope": "public",
"section": undefined,
"text": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index",
},
" something",
]
`);
expect(refs.length).toBe(3);
});

it('test single link', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { KibanaPlatformPlugin, ToolingLog } from '@kbn/dev-utils';
import { getApiSectionId, getPluginApiDocId, getPluginForPath } from '../utils';
import { ApiScope, TextWithLinks } from '../types';
import { getRelativePath } from './utils';

/**
*
Expand Down Expand Up @@ -54,6 +55,9 @@ export function extractImportReferences(
const str = textSegment.substr(index + length - name.length, name.length);
if (str && str !== '') {
texts.push(str);
} else {
// If there is no ".Name" then use the full path. You can see things like "typeof import("file")"
texts.push(getRelativePath(path));
}
} else {
const section = getApiSectionId({
Expand All @@ -69,10 +73,12 @@ export function extractImportReferences(
apiPath: path,
directory: plugin.directory,
}),
section,
text: name,
section: name && name !== '' ? section : undefined,
text: name && name !== '' ? name : getRelativePath(path),
});
}

// Prep textSegment to skip past the `import`, then check for more.
textSegment = textSegment.substr(index + length);
} else {
if (textSegment && textSegment !== '') {
Expand All @@ -87,10 +93,10 @@ export function extractImportReferences(
function extractImportRef(
str: string
): { path: string; name: string; index: number; length: number } | undefined {
const groups = str.match(/import\("(.*?)"\)\.(\w*)/);
const groups = str.match(/import\("(.*?)"\)\.?(\w*)/);
if (groups) {
const path = groups[1];
const name = groups[2];
const name = groups.length > 2 ? groups[2] : '';
const index = groups.index!;
const length = groups[0].length;
return { path, name, index, length };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function isPrivate(node: ParameterDeclaration | ClassMemberTypes): boolea
/**
* Change the absolute path into a relative one.
*/
function getRelativePath(fullPath: string): string {
export function getRelativePath(fullPath: string): string {
return Path.relative(REPO_ROOT, fullPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import ${json} from './${fileName}.json';
common: groupPluginApi(doc.common),
server: groupPluginApi(doc.server),
};
fs.writeFileSync(Path.resolve(folder, fileName + '.json'), JSON.stringify(scopedDoc));
fs.writeFileSync(Path.resolve(folder, fileName + '.json'), JSON.stringify(scopedDoc, null, 2));

mdx += scopApiToMdx(scopedDoc.client, 'Client', json, 'client');
mdx += scopApiToMdx(scopedDoc.server, 'Server', json, 'server');
Expand Down
1,567 changes: 1,566 additions & 1 deletion packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1,77 @@
{"id":"pluginA.foo","client":{"classes":[],"functions":[{"id":"def-public.doTheFooFnThing","type":"Function","children":[],"signature":["() => void"],"description":[],"label":"doTheFooFnThing","source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts","lineNumber":9,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L9"},"returnComment":[],"initialIsOpen":false}],"interfaces":[],"enums":[],"misc":[{"id":"def-public.FooType","type":"Type","label":"FooType","description":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts","lineNumber":11,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L11"},"signature":["() => \"foo\""],"initialIsOpen":false}],"objects":[]},"server":{"classes":[],"functions":[],"interfaces":[],"enums":[],"misc":[],"objects":[]},"common":{"classes":[],"functions":[],"interfaces":[],"enums":[],"misc":[{"id":"def-common.commonFoo","type":"string","label":"commonFoo","description":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts","lineNumber":9,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts#L9"},"signature":["\"COMMON VAR!\""],"initialIsOpen":false}],"objects":[]}}
{
"id": "pluginA.foo",
"client": {
"classes": [],
"functions": [
{
"id": "def-public.doTheFooFnThing",
"type": "Function",
"children": [],
"signature": [
"() => void"
],
"description": [],
"label": "doTheFooFnThing",
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts",
"lineNumber": 9,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L9"
},
"returnComment": [],
"initialIsOpen": false
}
],
"interfaces": [],
"enums": [],
"misc": [
{
"id": "def-public.FooType",
"type": "Type",
"label": "FooType",
"description": [],
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts",
"lineNumber": 11,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/foo/index.ts#L11"
},
"signature": [
"() => \"foo\""
],
"initialIsOpen": false
}
],
"objects": []
},
"server": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [],
"objects": []
},
"common": {
"classes": [],
"functions": [],
"interfaces": [],
"enums": [],
"misc": [
{
"id": "def-common.commonFoo",
"type": "string",
"label": "commonFoo",
"description": [],
"source": {
"path": "packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts",
"lineNumber": 9,
"link": "https://github.com/elastic/kibana/tree/masterpackages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/common/foo/index.ts#L9"
},
"signature": [
"\"COMMON VAR!\""
],
"initialIsOpen": false
}
],
"objects": []
}
}
2 changes: 1 addition & 1 deletion packages/kbn-docs-utils/src/api_docs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface Reference {
pluginId: string;
scope: ApiScope;
docId: string;
section: string;
section?: string;
text: string;
}

Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-docs-utils/src/api_docs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ export function getPluginApiDocId(
const cleanName = id.replace('.', '_');
if (serviceInfo) {
const serviceName = getServiceForPath(serviceInfo.apiPath, serviceInfo.directory);
log.debug(
`Service for path ${serviceInfo.apiPath} and ${serviceInfo.directory} is ${serviceName}`
);
const serviceFolder = serviceInfo.serviceFolders?.find((f) => f === serviceName);

if (serviceFolder) {
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';

import { migrateKibanaIndex, createStats, cleanKibanaIndices } from '../lib';

Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable } from 'stream';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { Client } from '@elastic/elasticsearch';
import { createPromiseFromStreams, concatStreamProviders } from '@kbn/utils';
import { ES_CLIENT_HEADERS } from '../client_headers';
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-es-archiver/src/actions/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from '@elastic/elasticsearch';
import { ToolingLog, KbnClient } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { createPromiseFromStreams } from '@kbn/utils';

import {
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import Url from 'url';
import readline from 'readline';
import Fs from 'fs';

import { RunWithCommands, createFlagError, KbnClient, CA_CERT_PATH } from '@kbn/dev-utils';
import { readConfigFile } from '@kbn/test';
import { RunWithCommands, createFlagError, CA_CERT_PATH } from '@kbn/dev-utils';
import { readConfigFile, KbnClient } from '@kbn/test';
import { Client } from '@elastic/elasticsearch';

import { EsArchiver } from './es_archiver';
Expand Down
Loading

0 comments on commit 99d5be4

Please sign in to comment.