Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export interface ISearchOptions
| Property | Type | Description |
| --- | --- | --- |
| [abortSignal](./kibana-plugin-plugins-data-public.isearchoptions.abortsignal.md) | <code>AbortSignal</code> | An <code>AbortSignal</code> that allows the caller of <code>search</code> to abort a search request. |
| [sessionId](./kibana-plugin-plugins-data-public.isearchoptions.sessionid.md) | <code>string</code> | A session ID, grouping multiple search requests into a single session. |
| [strategy](./kibana-plugin-plugins-data-public.isearchoptions.strategy.md) | <code>string</code> | Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) &gt; [sessionId](./kibana-plugin-plugins-data-public.isearchoptions.sessionid.md)

## ISearchOptions.sessionId property

A session ID, grouping multiple search requests into a single session.

<b>Signature:</b>

```typescript
sessionId?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export interface ISearchSetup
| Property | Type | Description |
| --- | --- | --- |
| [aggs](./kibana-plugin-plugins-data-public.isearchsetup.aggs.md) | <code>AggsSetup</code> | |
| [session](./kibana-plugin-plugins-data-public.isearchsetup.session.md) | <code>ISessionService</code> | session management |
| [usageCollector](./kibana-plugin-plugins-data-public.isearchsetup.usagecollector.md) | <code>SearchUsageCollector</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [ISearchSetup](./kibana-plugin-plugins-data-public.isearchsetup.md) &gt; [session](./kibana-plugin-plugins-data-public.isearchsetup.session.md)

## ISearchSetup.session property

session management

<b>Signature:</b>

```typescript
session: ISessionService;
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface ISearchStart
| [aggs](./kibana-plugin-plugins-data-public.isearchstart.aggs.md) | <code>AggsStart</code> | agg config sub service [AggsStart](./kibana-plugin-plugins-data-public.aggsstart.md) |
| [search](./kibana-plugin-plugins-data-public.isearchstart.search.md) | <code>ISearchGeneric</code> | low level search [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) |
| [searchSource](./kibana-plugin-plugins-data-public.isearchstart.searchsource.md) | <code>ISearchStartSearchSource</code> | high level search [ISearchStartSearchSource](./kibana-plugin-plugins-data-public.isearchstartsearchsource.md) |
| [session](./kibana-plugin-plugins-data-public.isearchstart.session.md) | <code>ISessionService</code> | session management |
| [showError](./kibana-plugin-plugins-data-public.isearchstart.showerror.md) | <code>(e: Error) =&gt; void</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [ISearchStart](./kibana-plugin-plugins-data-public.isearchstart.md) &gt; [session](./kibana-plugin-plugins-data-public.isearchstart.session.md)

## ISearchStart.session property

session management

<b>Signature:</b>

```typescript
session: ISessionService;
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal: AbortSignal, appAbortSignal?: AbortSignal): Error;
protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal: AbortSignal, options?: ISearchOptions): Error;
```

## Parameters
Expand All @@ -17,7 +17,7 @@ protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal
| e | <code>any</code> | |
| request | <code>IKibanaSearchRequest</code> | |
| timeoutSignal | <code>AbortSignal</code> | |
| appAbortSignal | <code>AbortSignal</code> | |
| options | <code>ISearchOptions</code> | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export declare class SearchInterceptor
| Method | Modifiers | Description |
| --- | --- | --- |
| [getTimeoutMode()](./kibana-plugin-plugins-data-public.searchinterceptor.gettimeoutmode.md) | | |
| [handleSearchError(e, request, timeoutSignal, appAbortSignal)](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md) | | |
| [handleSearchError(e, request, timeoutSignal, options)](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md) | | |
| [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given <code>search</code> method. Overrides the <code>AbortSignal</code> with one that will abort either when <code>cancelPending</code> is called, when the request times out, or when the original <code>AbortSignal</code> is aborted. Updates <code>pendingCount$</code> when the request is started/finalized. |
| [showError(e)](./kibana-plugin-plugins-data-public.searchinterceptor.showerror.md) | | |

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface SearchInterceptorDeps
| Property | Type | Description |
| --- | --- | --- |
| [http](./kibana-plugin-plugins-data-public.searchinterceptordeps.http.md) | <code>CoreSetup['http']</code> | |
| [session](./kibana-plugin-plugins-data-public.searchinterceptordeps.session.md) | <code>ISessionService</code> | |
| [startServices](./kibana-plugin-plugins-data-public.searchinterceptordeps.startservices.md) | <code>Promise&lt;[CoreStart, any, unknown]&gt;</code> | |
| [toasts](./kibana-plugin-plugins-data-public.searchinterceptordeps.toasts.md) | <code>ToastsSetup</code> | |
| [uiSettings](./kibana-plugin-plugins-data-public.searchinterceptordeps.uisettings.md) | <code>CoreSetup['uiSettings']</code> | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptorDeps](./kibana-plugin-plugins-data-public.searchinterceptordeps.md) &gt; [session](./kibana-plugin-plugins-data-public.searchinterceptordeps.session.md)

## SearchInterceptorDeps.session property

<b>Signature:</b>

```typescript
session: ISessionService;
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export interface ISearchOptions
| Property | Type | Description |
| --- | --- | --- |
| [abortSignal](./kibana-plugin-plugins-data-server.isearchoptions.abortsignal.md) | <code>AbortSignal</code> | An <code>AbortSignal</code> that allows the caller of <code>search</code> to abort a search request. |
| [sessionId](./kibana-plugin-plugins-data-server.isearchoptions.sessionid.md) | <code>string</code> | A session ID, grouping multiple search requests into a single session. |
| [strategy](./kibana-plugin-plugins-data-server.isearchoptions.strategy.md) | <code>string</code> | Use this option to force using a specific server side search strategy. Leave empty to use the default strategy. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) &gt; [ISearchOptions](./kibana-plugin-plugins-data-server.isearchoptions.md) &gt; [sessionId](./kibana-plugin-plugins-data-server.isearchoptions.sessionid.md)

## ISearchOptions.sessionId property

A session ID, grouping multiple search requests into a single session.

<b>Signature:</b>

```typescript
sessionId?: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ export class DashboardAppController {
notifications,
overlays,
chrome,
injectedMetadata,
fatalErrors,
uiSettings,
savedObjects,
Expand Down Expand Up @@ -527,9 +526,6 @@ export class DashboardAppController {
filterManager.getFilters()
);

timefilter.disableTimeRangeSelector();
timefilter.disableAutoRefreshSelector();

const landingPageUrl = () => `#${DashboardConstants.LANDING_PAGE_PATH}`;

const getDashTitle = () =>
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/data/common/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { getSessionServiceMock } from './search/session/mocks';
5 changes: 5 additions & 0 deletions src/plugins/data/common/search/es_search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export interface ISearchOptions {
* Use this option to force using a specific server side search strategy. Leave empty to use the default strategy.
*/
strategy?: string;

/**
* A session ID, grouping multiple search requests into a single session.
*/
sessionId?: string;
}

export type ISearchRequestParams<T = Record<string, any>> = {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export * from './expressions';
export * from './search_source';
export * from './tabify';
export * from './types';
export * from './session';
20 changes: 20 additions & 0 deletions src/plugins/data/common/search/session/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export * from './types';
29 changes: 29 additions & 0 deletions src/plugins/data/common/search/session/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { ISessionService } from './types';

export function getSessionServiceMock(): jest.Mocked<ISessionService> {
return {
clear: jest.fn(),
start: jest.fn(),
getSessionId: jest.fn(),
getSession$: jest.fn(),
};
}
41 changes: 41 additions & 0 deletions src/plugins/data/common/search/session/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Observable } from 'rxjs';

export interface ISessionService {
/**
* Returns the active session ID
* @returns The active session ID
*/
getSessionId: () => string | undefined;
/**
* Returns the observable that emits an update every time the session ID changes
* @returns `Observable`
*/
getSession$: () => Observable<string | undefined>;
/**
* Starts a new session
*/
start: () => string;
/**
* Clears the active session.
*/
clear: () => void;
}
12 changes: 10 additions & 2 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ export type ISearchGeneric = <SearchStrategyRequest extends IKibanaSearchRequest
// @public (undocumented)
export interface ISearchOptions {
abortSignal?: AbortSignal;
sessionId?: string;
strategy?: string;
}

Expand All @@ -1412,6 +1413,9 @@ export interface ISearchSetup {
//
// (undocumented)
aggs: AggsSetup;
// Warning: (ae-forgotten-export) The symbol "ISessionService" needs to be exported by the entry point index.d.ts
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "ISessionService"
session: ISessionService;
// Warning: (ae-forgotten-export) The symbol "SearchUsageCollector" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand All @@ -1426,6 +1430,8 @@ export interface ISearchStart {
aggs: AggsStart;
search: ISearchGeneric;
searchSource: ISearchStartSearchSource;
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "ISessionService"
session: ISessionService;
// (undocumented)
showError: (e: Error) => void;
}
Expand Down Expand Up @@ -1995,7 +2001,7 @@ export class SearchInterceptor {
// (undocumented)
protected getTimeoutMode(): TimeoutErrorMode;
// (undocumented)
protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal: AbortSignal, appAbortSignal?: AbortSignal): Error;
protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal: AbortSignal, options?: ISearchOptions): Error;
// @internal
protected pendingCount$: BehaviorSubject<number>;
// @internal (undocumented)
Expand All @@ -2006,8 +2012,8 @@ export class SearchInterceptor {
abortSignal?: AbortSignal;
timeout?: number;
}): {
combinedSignal: AbortSignal;
timeoutSignal: AbortSignal;
combinedSignal: AbortSignal;
cleanup: () => void;
};
// (undocumented)
Expand All @@ -2021,6 +2027,8 @@ export interface SearchInterceptorDeps {
// (undocumented)
http: CoreSetup_2['http'];
// (undocumented)
session: ISessionService;
// (undocumented)
startServices: Promise<[CoreStart, any, unknown]>;
// (undocumented)
toasts: ToastsSetup;
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data/public/search/expressions/esaggs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ const handleCourierRequest = async ({
request.stats(getRequestInspectorStats(requestSearchSource));

try {
const response = await requestSearchSource.fetch({ abortSignal });
const response = await requestSearchSource.fetch({
abortSignal,
});

request.stats(getResponseInspectorStats(response, searchSource)).ok({ json: response });

Expand Down
3 changes: 3 additions & 0 deletions src/plugins/data/public/search/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import { searchAggsSetupMock, searchAggsStartMock } from './aggs/mocks';
import { searchSourceMock } from './search_source/mocks';
import { ISearchSetup, ISearchStart } from './types';
import { getSessionServiceMock } from '../../common/mocks';

function createSetupContract(): jest.Mocked<ISearchSetup> {
return {
aggs: searchAggsSetupMock(),
__enhance: jest.fn(),
session: getSessionServiceMock(),
};
}

Expand All @@ -33,6 +35,7 @@ function createStartContract(): jest.Mocked<ISearchStart> {
aggs: searchAggsStartMock(),
search: jest.fn(),
showError: jest.fn(),
session: getSessionServiceMock(),
searchSource: searchSourceMock.createStartContract(),
};
}
Expand Down
Loading