Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/refactor-endpoint-details-midd…
Browse files Browse the repository at this point in the history
…leware-1575
  • Loading branch information
academo committed Aug 12, 2021
2 parents 7b9bbf3 + 997e9ec commit 0fe5eb6
Show file tree
Hide file tree
Showing 507 changed files with 10,985 additions and 2,915 deletions.
1 change: 0 additions & 1 deletion docs/developer/advanced/running-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ If many other users will be interacting with your remote cluster, you'll want to
[source,bash]
----
kibana.index: '.{YourGitHubHandle}-kibana'
xpack.task_manager.index: '.{YourGitHubHandle}-task-manager-kibana'
----

==== Running remote clusters
Expand Down
3 changes: 0 additions & 3 deletions docs/settings/task-manager-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ Task Manager runs background tasks by polling for work on an interval. You can
| `xpack.task_manager.request_capacity`
| How many requests can Task Manager buffer before it rejects new requests. Defaults to 1000.

| `xpack.task_manager.index`
| The name of the index used to store task information. Defaults to `.kibana_task_manager`.

| `xpack.task_manager.max_workers`
| The maximum number of tasks that this Kibana instance will run simultaneously. Defaults to 10.
Starting in 8.0, it will not be possible to set the value greater than 100.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This has three major benefits:

[IMPORTANT]
==============================================
Task definitions for alerts and actions are stored in the index specified by <<task-manager-settings, `xpack.task_manager.index`>>. The default is `.kibana_task_manager`.
Task definitions for alerts and actions are stored in the index `.kibana_task_manager`.
You must have at least one replica of this index for production deployments.
Expand Down
19 changes: 12 additions & 7 deletions docs/user/reporting/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--

:keywords: analyst, concept, task, reporting
:description: {kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads with others, or on a website.
:description: {kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads with others, or on a website.

{kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads.
{kib} provides you with several options to share *Discover* saved searches, dashboards, *Visualize Library* visualizations, and *Canvas* workpads.

You access the options from the *Share* menu in the toolbar. The sharing options include the following:

Expand All @@ -34,9 +34,9 @@ You access the options from the *Share* menu in the toolbar. The sharing options
Create and download PDF, PNG, or CSV reports of saved searches, dashboards, visualizations, and workpads.

[[reporting-layout-sizing]]
The layout and size of the report depends on what you are sharing.
The layout and size of the report depends on what you are sharing.
For saved searches, dashboards, and visualizations, the layout depends on the size of the panels.
For workpads, the layout depends on the size of the worksheet dimensions.
For workpads, the layout depends on the size of the worksheet dimensions.

To change the output size, change the size of the browser, which resizes the shareable container before the report generates. It might take some trial and error before you're satisfied.

Expand Down Expand Up @@ -67,6 +67,11 @@ NOTE: When you create a dashboard report that includes a data table or saved sea

. To view and manage reports, open the main menu, then click *Stack Management > Reporting*.

NOTE: Reports are stored in {es} and managed by the `kibana-reporting` {ilm}
({ilm-init}) policy. By default, the policy stores reports forever. To learn
more about {ilm-init} policies, refer to the {es}
{ref}/index-lifecycle-management.html[{ilm-init} documentation].

[float]
[[share-a-direct-link]]
== Share a direct link
Expand Down Expand Up @@ -102,15 +107,15 @@ Create a JSON file for a workpad.

. Open the main menu, then click *Canvas*.

. Open the workpad you want to share.
. Open the workpad you want to share.

. From the toolbar, click *Share*, then select *Download as JSON*.

[float]
[[add-workpad-website]]
== Share workpads on a website

beta[] *Canvas* allows you to create _shareables_, which are workpads that you download and securely share on a website.
beta[] *Canvas* allows you to create _shareables_, which are workpads that you download and securely share on a website.
To customize the behavior of the workpad on your website, you can choose to autoplay the pages or hide the workpad toolbar.

. Open the main menu, then click *Canvas*.
Expand Down Expand Up @@ -139,7 +144,7 @@ Some users might not have access to the dashboard or visualization. For more inf

. Open the main menu, then open the dashboard or visualization you want to share.

. Click *Share > Embed code*.
. Click *Share > Embed code*.

. Specify how you want to generate the code:

Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class HelloWorldPlugin implements Plugin<void, void, SetupDeps> {
id: 'helloWorld',
title: 'Hello World',
async mount({ element }: AppMountParameters) {
ReactDOM.render(<div id="helloWorldDiv">Hello World!</div>, element);
ReactDOM.render(<div data-test-subj="helloWorldDiv">Hello World!</div>, element);
return () => ReactDOM.unmountComponentAtNode(element);
},
});
Expand Down
7 changes: 6 additions & 1 deletion examples/search_examples/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@
"ui": true,
"requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share"],
"optionalPlugins": [],
"requiredBundles": ["kibanaReact"]
"requiredBundles": ["kibanaReact"],
"owner": {
"name": "App Services",
"githubTeam": "kibana-app-services"
},
"description": "Examples for using the data plugin search service. Includes examples for searching using the high level search source, or low-level search services, as well as integrating with search sessions."
}
3 changes: 3 additions & 0 deletions packages/kbn-crypto/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
22 changes: 13 additions & 9 deletions packages/kbn-crypto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")

PKG_BASE_NAME = "kbn-crypto"
PKG_REQUIRE_NAME = "@kbn/crypto"
Expand All @@ -26,22 +27,24 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]

SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/kbn-dev-utils",
"@npm//node-forge",
]

TYPES_DEPS = [
"//packages/kbn-dev-utils",
"@npm//@types/flot",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/node-forge",
"@npm//@types/testing-library__jest-dom",
"@npm//resize-observer-polyfill",
"@npm//@emotion/react",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -53,13 +56,14 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
Expand All @@ -68,7 +72,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts"
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts"
}
3 changes: 2 additions & 1 deletion packages/kbn-crypto/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"outDir": "./target/types",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./target_types",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-crypto/src",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ const testRecords = [
},
];

// FLAKY: https://github.com/elastic/kibana/issues/108043
it.skip('indexes documents using the bulk client helper', async () => {
it('indexes documents using the bulk client helper', async () => {
const client = new MockClient();
client.helpers.bulk.mockImplementation(async () => {});

const progress = new Progress();
const stats = createStats('test', log);
Expand Down Expand Up @@ -186,11 +184,11 @@ it.skip('indexes documents using the bulk client helper', async () => {
"results": Array [
Object {
"type": "return",
"value": Promise {},
"value": undefined,
},
Object {
"type": "return",
"value": Promise {},
"value": undefined,
},
],
}
Expand Down
9 changes: 5 additions & 4 deletions packages/kbn-es-query/src/es_query/build_es_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import { buildQueryFromFilters } from './from_filters';
import { buildQueryFromLucene } from './from_lucene';
import { Filter, Query } from '../filters';
import { IndexPatternBase } from './types';
import { KueryQueryOptions } from '../kuery';

/**
* Configurations to be used while constructing an ES query.
* @public
*/
export interface EsQueryConfig {
export type EsQueryConfig = KueryQueryOptions & {
allowLeadingWildcards: boolean;
queryStringOptions: Record<string, any>;
ignoreFilterIfFieldNotInIndex: boolean;
dateFormatTZ?: string;
}
};

function removeMatchAll<T>(filters: T[]) {
return filters.filter(
Expand Down Expand Up @@ -59,7 +59,8 @@ export function buildEsQuery(
indexPattern,
queriesByLanguage.kuery,
config.allowLeadingWildcards,
config.dateFormatTZ
config.dateFormatTZ,
config.filtersInMustClause
);
const luceneQuery = buildQueryFromLucene(
queriesByLanguage.lucene,
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-es-query/src/es_query/from_kuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ export function buildQueryFromKuery(
indexPattern: IndexPatternBase | undefined,
queries: Query[] = [],
allowLeadingWildcards: boolean = false,
dateFormatTZ?: string
dateFormatTZ?: string,
filtersInMustClause: boolean = false
) {
const queryASTs = queries.map((query) => {
return fromKueryExpression(query.query, { allowLeadingWildcards });
});

return buildQuery(indexPattern, queryASTs, { dateFormatTZ });
return buildQuery(indexPattern, queryASTs, { dateFormatTZ, filtersInMustClause });
}

function buildQuery(
Expand Down
18 changes: 18 additions & 0 deletions packages/kbn-es-query/src/kuery/functions/and.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ describe('kuery functions', () => {
)
);
});

test("should wrap subqueries in an ES bool query's must clause for scoring if enabled", () => {
const node = nodeTypes.function.buildNode('and', [childNode1, childNode2]);
const result = and.toElasticsearchQuery(node, indexPattern, {
filtersInMustClause: true,
});

expect(result).toHaveProperty('bool');
expect(Object.keys(result).length).toBe(1);
expect(result.bool).toHaveProperty('must');
expect(Object.keys(result.bool).length).toBe(1);

expect(result.bool.must).toEqual(
[childNode1, childNode2].map((childNode) =>
ast.toElasticsearchQuery(childNode, indexPattern)
)
);
});
});
});
});
8 changes: 5 additions & 3 deletions packages/kbn-es-query/src/kuery/functions/and.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as ast from '../ast';
import { IndexPatternBase, KueryNode } from '../..';
import { IndexPatternBase, KueryNode, KueryQueryOptions } from '../..';

export function buildNodeParams(children: KueryNode[]) {
return {
Expand All @@ -18,14 +18,16 @@ export function buildNodeParams(children: KueryNode[]) {
export function toElasticsearchQuery(
node: KueryNode,
indexPattern?: IndexPatternBase,
config: Record<string, any> = {},
config: KueryQueryOptions = {},
context: Record<string, any> = {}
) {
const { filtersInMustClause } = config;
const children = node.arguments || [];
const key = filtersInMustClause ? 'must' : 'filter';

return {
bool: {
filter: children.map((child: KueryNode) => {
[key]: children.map((child: KueryNode) => {
return ast.toElasticsearchQuery(child, indexPattern, config, context);
}),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-query/src/kuery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
export { KQLSyntaxError } from './kuery_syntax_error';
export { nodeTypes, nodeBuilder } from './node_types';
export { fromKueryExpression, toElasticsearchQuery } from './ast';
export { DslQuery, KueryNode } from './types';
export { DslQuery, KueryNode, KueryQueryOptions } from './types';
6 changes: 6 additions & 0 deletions packages/kbn-es-query/src/kuery/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ export interface KueryParseOptions {
}

export { nodeTypes } from './node_types';

/** @public */
export interface KueryQueryOptions {
filtersInMustClause?: boolean;
dateFormatTZ?: string;
}
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pageLoadAssetSize:
charts: 95000
cloud: 21076
console: 46091
core: 434325
core: 435325
crossClusterReplication: 65408
dashboard: 374194
dashboardEnhanced: 65646
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-rule-data-utils/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
Loading

0 comments on commit 0fe5eb6

Please sign in to comment.