Skip to content

Commit

Permalink
Merge branch 'master' into ml-115772-nodes-overview
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 27, 2021
2 parents 783a713 + bacd7f9 commit 398ffd7
Show file tree
Hide file tree
Showing 348 changed files with 5,466 additions and 5,298 deletions.
12 changes: 6 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import %workspace%/.bazelrc.common

# Remote cache settings for local env
build --remote_cache=grpcs://cloud.buildbuddy.io
build --incompatible_remote_results_ignore_disk=true
build --noremote_upload_local_results
build --remote_timeout=30
build --remote_header=x-buildbuddy-api-key=3EYk49W2NefOx2n3yMze
build --remote_accept_cached=true
# build --remote_cache=grpcs://cloud.buildbuddy.io
# build --incompatible_remote_results_ignore_disk=true
# build --noremote_upload_local_results
# build --remote_timeout=30
# build --remote_header=x-buildbuddy-api-key=3EYk49W2NefOx2n3yMze
# build --remote_accept_cached=true

# Enable this in case you want to share your build info
# build --build_metadata=VISIBILITY=PUBLIC
Expand Down
4 changes: 2 additions & 2 deletions api_docs/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -7610,10 +7610,10 @@
},
{
"parentPluginId": "cases",
"id": "def-common.ConnectorResillientTypeFields",
"id": "def-common.ConnectorResilientTypeFields",
"type": "Type",
"tags": [],
"label": "ConnectorResillientTypeFields",
"label": "ConnectorResilientTypeFields",
"description": [],
"signature": [
"{ type: ",
Expand Down
10 changes: 5 additions & 5 deletions dev_docs/tutorials/data/search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tags: ['kibana', 'onboarding', 'dev', 'tutorials', 'search', 'sessions', 'search

Searching data stored in Elasticsearch can be done in various ways, for example using the Elasticsearch REST API or using an `Elasticsearch Client` for low level access.

However, the recommended and easist way to search Elasticsearch is by using the low level search service. The service is exposed from the `data` plugin, and by using it, you not only gain access to the data you stored, but also to capabilities, such as Custom Search Strategies, Asynchronous Search, Partial Results, Search Sessions, and more.
However, the recommended and easiest way to search Elasticsearch is by using the low level search service. The service is exposed from the `data` plugin, and by using it, you not only gain access to the data you stored, but also to capabilities, such as Custom Search Strategies, Asynchronous Search, Partial Results, Search Sessions, and more.

Here is a basic example for using the `data.search` service from a custom plugin:

Expand Down Expand Up @@ -418,11 +418,11 @@ export class MyPlugin implements Plugin {
// return the name you want to give the saved Search Session
return `MyApp_${Math.random()}`;
},
getUrlGeneratorData: async () => {
getLocatorData: async () => {
return {
urlGeneratorId: MY_URL_GENERATOR,
initialState: getUrlGeneratorState({ ...deps, shouldRestoreSearchSession: false }),
restoreState: getUrlGeneratorState({ ...deps, shouldRestoreSearchSession: true }),
id: MY_LOCATOR,
initialState: getLocatorParams({ ...deps, shouldRestoreSearchSession: false }),
restoreState: getLocatorParams({ ...deps, shouldRestoreSearchSession: true }),
};
},
});
Expand Down
1 change: 1 addition & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ yarn kbn watch
- @kbn/securitysolution-list-constants
- @kbn/securitysolution-list-hooks
- @kbn/securitysolution-list-utils
- @kbn/securitysolution-rules
- @kbn/securitysolution-utils
- @kbn/server-http-tools
- @kbn/server-route-repository
Expand Down
56 changes: 23 additions & 33 deletions docs/setup/upgrade.asciidoc
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
[[upgrade]]
== Upgrade {kib}

Depending on the {kib} version you're upgrading from, the upgrade process to {version}
varies. The following upgrades are supported:
You can always upgrade to the latest patch release or from one minor version
to another within the same major version series.

* Between minor versions
* From 5.6 to 6.8
* From 6.8 to {prev-major-version}
* From {prev-major-version} to {version}
ifeval::[ "{version}" != "{minor-version}.0" ]
* From any version since {minor-version}.0 to {version}
endif::[]
For major version upgrades:

The following table shows the recommended upgrade paths to {version}.
. Upgrade to the last minor version released before the new major version.
. Use the Upgrade Assistant to determine what changes you need to make before the major version upgrade.
. When you've addressed all the critical issues, upgrade {es} and then upgrade {kib}.

IMPORTANT: You can upgrade to pre-release versions of 8.0 for testing,
but upgrading from a pre-release to the final GA version is not supported.
Pre-releases should only be used for testing in a temporary environment.

[discrete]
[[upgrade-paths]]
=== Recommended upgrade paths to 8.0

[cols="<1,3",options="header",]
|====
|Upgrade from
|Recommended upgrade path to {version}

ifeval::[ "{version}" != "{minor-version}.0" ]
|A previous {minor-version} version (e.g., {minor-version}.0)
|Upgrade to {version}
endif::[]
|Upgrading from
|Upgrade path

|{prev-major-version}
|Upgrade to {version}
|7.16
|Upgrade to 8.0

|7.0–7.7
|6.8–7.15
a|
. Upgrade to {prev-major-version}
. Upgrade to {version}

|6.8
a|
. Upgrade to {prev-major-version}
. Upgrade to {version}
. Upgrade to 7.16
. Upgrade to 8.0

|6.0–6.7
a|

. Upgrade to 6.8
. Upgrade to {prev-major-version}
. Upgrade to {version}
. Upgrade to 7.16
. Upgrade to 8.0
|====

[WARNING]
====
The upgrade path from 6.8 to 7.0 is *not* supported.
====

[float]
[[upgrade-before-you-begin]]
=== Before you begin
Expand Down
20 changes: 8 additions & 12 deletions examples/search_examples/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

import {
AppMountParameters,
AppNavLinkStatus,
CoreSetup,
CoreStart,
Plugin,
AppNavLinkStatus,
} from '../../../src/core/public';
import {
SearchExamplesPluginSetup,
SearchExamplesPluginStart,
AppPluginSetupDependencies,
AppPluginStartDependencies,
SearchExamplesPluginSetup,
SearchExamplesPluginStart,
} from './types';
import { createSearchSessionsExampleUrlGenerator } from './search_sessions/url_generator';
import { SearchSessionsExamplesAppLocatorDefinition } from './search_sessions/app_locator';
import { PLUGIN_NAME } from '../common';
import img from './search_examples.png';

Expand Down Expand Up @@ -67,14 +67,10 @@ export class SearchExamplesPlugin
],
});

// we need an URL generator for search session examples for restoring a search session
share.urlGenerators.registerUrlGenerator(
createSearchSessionsExampleUrlGenerator(() => {
return core
.getStartServices()
.then(([coreStart]) => ({ appBasePath: coreStart.http.basePath.get() }));
})
);
// we need an locator for search session examples for restoring a search session
const getAppBasePath = () =>
core.getStartServices().then(([coreStart]) => coreStart.http.basePath.get());
share.url.locators.create(new SearchSessionsExamplesAppLocatorDefinition(getAppBasePath));

return {};
}
Expand Down
14 changes: 5 additions & 9 deletions examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ import {
createStateContainer,
useContainerState,
} from '../../../../src/plugins/kibana_utils/public';
import {
getInitialStateFromUrl,
SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR,
SearchSessionExamplesUrlGeneratorState,
} from './url_generator';
import { getInitialStateFromUrl, SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR } from './app_locator';

interface SearchSessionsExampleAppDeps {
notifications: CoreStart['notifications'];
Expand Down Expand Up @@ -140,23 +136,23 @@ export const SearchSessionsExampleApp = ({
const enableSessionStorage = useCallback(() => {
data.search.session.enableStorage({
getName: async () => 'Search sessions example',
getUrlGeneratorData: async () => ({
getLocatorData: async () => ({
initialState: {
time: data.query.timefilter.timefilter.getTime(),
filters: data.query.filterManager.getFilters(),
query: data.query.queryString.getQuery(),
indexPatternId: indexPattern?.id,
numericFieldName,
} as SearchSessionExamplesUrlGeneratorState,
},
restoreState: {
time: data.query.timefilter.timefilter.getAbsoluteTime(),
filters: data.query.filterManager.getFilters(),
query: data.query.queryString.getQuery(),
indexPatternId: indexPattern?.id,
numericFieldName,
searchSessionId: data.search.session.getSessionId(),
} as SearchSessionExamplesUrlGeneratorState,
urlGeneratorId: SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR,
},
id: SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR,
}),
});
}, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,50 @@
* Side Public License, v 1.
*/

import { TimeRange, Filter, Query, esFilters } from '../../../../src/plugins/data/public';
import { SerializableRecord } from '@kbn/utility-types';
import { esFilters, Filter, Query, TimeRange } from '../../../../src/plugins/data/public';
import { getStatesFromKbnUrl, setStateToKbnUrl } from '../../../../src/plugins/kibana_utils/public';
import { UrlGeneratorsDefinition } from '../../../../src/plugins/share/public';
import { LocatorDefinition } from '../../../../src/plugins/share/common';

export const STATE_STORAGE_KEY = '_a';
export const GLOBAL_STATE_STORAGE_KEY = '_g';

export const SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR =
'SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR';
export const SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR = 'SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR';

export interface AppUrlState {
export interface AppUrlState extends SerializableRecord {
filters?: Filter[];
query?: Query;
indexPatternId?: string;
numericFieldName?: string;
searchSessionId?: string;
}

export interface GlobalUrlState {
export interface GlobalUrlState extends SerializableRecord {
filters?: Filter[];
time?: TimeRange;
}

export type SearchSessionExamplesUrlGeneratorState = AppUrlState & GlobalUrlState;
export type SearchSessionsExamplesAppLocatorParams = AppUrlState & GlobalUrlState;

export const createSearchSessionsExampleUrlGenerator = (
getStartServices: () => Promise<{
appBasePath: string;
}>
): UrlGeneratorsDefinition<typeof SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR> => ({
id: SEARCH_SESSIONS_EXAMPLES_APP_URL_GENERATOR,
createUrl: async (state: SearchSessionExamplesUrlGeneratorState) => {
const startServices = await getStartServices();
const appBasePath = startServices.appBasePath;
const path = `${appBasePath}/app/searchExamples/search-sessions`;
export class SearchSessionsExamplesAppLocatorDefinition
implements LocatorDefinition<SearchSessionsExamplesAppLocatorParams>
{
public readonly id = SEARCH_SESSIONS_EXAMPLES_APP_LOCATOR;

constructor(protected readonly getAppBasePath: () => Promise<string>) {}

public readonly getLocation = async (params: SearchSessionsExamplesAppLocatorParams) => {
const appBasePath = await this.getAppBasePath();
const path = `${appBasePath}/search-sessions`;

let url = setStateToKbnUrl<AppUrlState>(
STATE_STORAGE_KEY,
{
query: state.query,
filters: state.filters?.filter((f) => !esFilters.isFilterPinned(f)),
indexPatternId: state.indexPatternId,
numericFieldName: state.numericFieldName,
searchSessionId: state.searchSessionId,
query: params.query,
filters: params.filters?.filter((f) => !esFilters.isFilterPinned(f)),
indexPatternId: params.indexPatternId,
numericFieldName: params.numericFieldName,
searchSessionId: params.searchSessionId,
} as AppUrlState,
{ useHash: false, storeInHashQuery: false },
path
Expand All @@ -58,18 +58,22 @@ export const createSearchSessionsExampleUrlGenerator = (
url = setStateToKbnUrl<GlobalUrlState>(
GLOBAL_STATE_STORAGE_KEY,
{
time: state.time,
filters: state.filters?.filter((f) => esFilters.isFilterPinned(f)),
time: params.time,
filters: params.filters?.filter((f) => esFilters.isFilterPinned(f)),
} as GlobalUrlState,
{ useHash: false, storeInHashQuery: false },
url
);

return url;
},
});
return {
app: 'searchExamples',
path: url,
state: {},
};
};
}

export function getInitialStateFromUrl(): SearchSessionExamplesUrlGeneratorState {
export function getInitialStateFromUrl(): SearchSessionsExamplesAppLocatorParams {
const {
_a: { numericFieldName, indexPatternId, searchSessionId, filters: aFilters, query } = {},
_g: { filters: gFilters, time } = {},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"@kbn/securitysolution-list-constants": "link:bazel-bin/packages/kbn-securitysolution-list-constants",
"@kbn/securitysolution-list-hooks": "link:bazel-bin/packages/kbn-securitysolution-list-hooks",
"@kbn/securitysolution-list-utils": "link:bazel-bin/packages/kbn-securitysolution-list-utils",
"@kbn/securitysolution-rules": "link:bazel-bin/packages/kbn-securitysolution-rules",
"@kbn/securitysolution-t-grid": "link:bazel-bin/packages/kbn-securitysolution-t-grid",
"@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils",
"@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools",
Expand Down Expand Up @@ -330,7 +331,7 @@
"react-moment-proptypes": "^1.7.0",
"react-monaco-editor": "^0.41.2",
"react-popper-tooltip": "^2.10.1",
"react-query": "^3.27.0",
"react-query": "^3.28.0",
"react-redux": "^7.2.0",
"react-resizable": "^1.7.5",
"react-resize-detector": "^4.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ filegroup(
"//packages/kbn-securitysolution-list-api:build",
"//packages/kbn-securitysolution-list-hooks:build",
"//packages/kbn-securitysolution-list-utils:build",
"//packages/kbn-securitysolution-rules:build",
"//packages/kbn-securitysolution-utils:build",
"//packages/kbn-securitysolution-es-utils:build",
"//packages/kbn-securitysolution-t-grid:build",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const CONSUMERS = `${KIBANA_NAMESPACE}.consumers` as const;
const ECS_VERSION = 'ecs.version' as const;
const EVENT_ACTION = 'event.action' as const;
const EVENT_KIND = 'event.kind' as const;
const EVENT_MODULE = 'event.module' as const;
const SPACE_IDS = `${KIBANA_NAMESPACE}.space_ids` as const;
const TAGS = 'tags' as const;
const TIMESTAMP = '@timestamp' as const;
Expand Down Expand Up @@ -88,6 +89,7 @@ const fields = {
ECS_VERSION,
EVENT_KIND,
EVENT_ACTION,
EVENT_MODULE,
TAGS,
TIMESTAMP,
ALERT_ACTION_GROUP,
Expand Down Expand Up @@ -189,6 +191,7 @@ export {
ECS_VERSION,
EVENT_ACTION,
EVENT_KIND,
EVENT_MODULE,
KIBANA_NAMESPACE,
ALERT_RULE_UUID,
ALERT_RULE_CATEGORY,
Expand Down
Loading

0 comments on commit 398ffd7

Please sign in to comment.