Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search typescript #69333

Merged
merged 45 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d964c84
[search] Refactor the way search strategies are registered/retrieved …
lukasolson Jun 5, 2020
1452ed5
Fix types and tests and update docs
lukasolson Jun 9, 2020
c7d6b61
Fix failing test
lukasolson Jun 9, 2020
955bd88
Fix build of example plugin
lukasolson Jun 10, 2020
93b41fe
Merge branch 'master' into refactorServerGetStrategy
lukasolson Jun 10, 2020
b0be2df
Fix functional test
lukasolson Jun 10, 2020
e09429a
Merge branch 'master' of github.com:elastic/kibana into pr/68452
Jun 16, 2020
4eb9dd1
Merge branch 'master' of github.com:elastic/kibana into pr/68452
Jun 16, 2020
b536e74
Make server strategies sync
Jun 16, 2020
1c79c1f
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jun 16, 2020
97c456e
Move strategy name into options
Jun 16, 2020
239e3a5
docs
Jun 17, 2020
cd21c29
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jun 18, 2020
b918556
Remove FE strategies
Jun 18, 2020
dbb943a
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jun 25, 2020
823e56a
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jun 28, 2020
ddd0d0e
TypeScript of hell
Jun 28, 2020
aa5958d
Merge branch 'search/server-side-search-strategy' of github.com:lizoz…
Jun 28, 2020
a708610
Fix search interceptor OSS tests
Jun 29, 2020
0b97b0e
typos
Jun 30, 2020
8897f99
test cleanup
Jun 30, 2020
c9f7a96
Delete search example
Jun 30, 2020
44bc4af
docs
Jun 30, 2020
bdb8b33
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jun 30, 2020
7e83fe9
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jun 30, 2020
21645a9
fix
Jun 30, 2020
2f6ad45
Merge branch 'search/server-side-search-strategy' of github.com:lizoz…
Jun 30, 2020
1cd5486
return search wrapper
Jun 30, 2020
14c4be2
Update search interceptor tests and abort utils
lukasolson Jun 30, 2020
4abd144
Merge branch 'search/server-side-search-strategy' of github.com:lizoz…
lukasolson Jun 30, 2020
0d1321a
Merge branch 'search/server-side-search-strategy' of github.com:lizoz…
Jul 1, 2020
d899ecc
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jul 1, 2020
8183a3f
ts
Jul 1, 2020
83a75a5
jest test fix
Jul 1, 2020
6e47178
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 1, 2020
e1c2438
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 1, 2020
ad2096c
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 2, 2020
2d10acf
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jul 5, 2020
6e2180d
code review
Jul 5, 2020
f6a0fa7
change how logs consume search API
Jul 5, 2020
eff55c5
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 5, 2020
bc4fb7b
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 6, 2020
a625e0b
Merge branch 'master' into search/server-side-search-strategy
elasticmachine Jul 7, 2020
be9b129
Merge branch 'master' of github.com:elastic/kibana into search/server…
Jul 7, 2020
d3b5eeb
Merge branch 'search/server-side-search-strategy' of github.com:lizoz…
Jul 7, 2020
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 @@ -10,16 +10,7 @@
export declare function getSearchParamsFromRequest(searchRequest: SearchRequest, dependencies: {
injectedMetadata: CoreStart['injectedMetadata'];
uiSettings: IUiSettingsClient;
}): {
rest_total_hits_as_int: boolean;
ignore_unavailable: boolean;
ignore_throttled: boolean;
max_concurrent_shard_requests: any;
preference: any;
timeout: string | undefined;
index: any;
body: any;
};
}): ISearchRequestParams;
```

## Parameters
Expand All @@ -31,14 +22,5 @@ export declare function getSearchParamsFromRequest(searchRequest: SearchRequest,

<b>Returns:</b>

`{
rest_total_hits_as_int: boolean;
ignore_unavailable: boolean;
ignore_throttled: boolean;
max_concurrent_shard_requests: any;
preference: any;
timeout: string | undefined;
index: any;
body: any;
}`
`ISearchRequestParams`

Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export interface IEsSearchRequest extends IKibanaSearchRequest
| Property | Type | Description |
| --- | --- | --- |
| [indexType](./kibana-plugin-plugins-data-public.iessearchrequest.indextype.md) | <code>string</code> | |
| [params](./kibana-plugin-plugins-data-public.iessearchrequest.params.md) | <code>SearchParams</code> | |
| [params](./kibana-plugin-plugins-data-public.iessearchrequest.params.md) | <code>ISearchRequestParams</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
params: SearchParams;
params?: ISearchRequestParams;
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<b>Signature:</b>

```typescript
export interface IEsSearchResponse<Hits = unknown> extends IKibanaSearchResponse
export interface IEsSearchResponse extends IKibanaSearchResponse
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [rawResponse](./kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md) | <code>SearchResponse&lt;Hits&gt;</code> | |
| [rawResponse](./kibana-plugin-plugins-data-public.iessearchresponse.rawresponse.md) | <code>SearchResponse&lt;any&gt;</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
rawResponse: SearchResponse<Hits>;
rawResponse: SearchResponse<any>;
```

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
export declare type ISearch<T extends TStrategyTypes = typeof DEFAULT_SEARCH_STRATEGY> = (request: IRequestTypesMap[T], options?: ISearchOptions) => Observable<IResponseTypesMap[T]>;
export declare type ISearch = (request: IKibanaSearchRequest, options?: ISearchOptions) => Observable<IKibanaSearchResponse>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
export declare type ISearchGeneric = <T extends TStrategyTypes = typeof DEFAULT_SEARCH_STRATEGY>(request: IRequestTypesMap[T], options?: ISearchOptions, strategy?: T) => Observable<IResponseTypesMap[T]>;
export declare type ISearchGeneric = (request: IEsSearchRequest, options?: IStrategyOptions) => Observable<IEsSearchResponse>;
```

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@
| [IKibanaSearchResponse](./kibana-plugin-plugins-data-public.ikibanasearchresponse.md) | |
| [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) | Use data plugin interface instead |
| [IndexPatternTypeMeta](./kibana-plugin-plugins-data-public.indexpatterntypemeta.md) | |
| [IRequestTypesMap](./kibana-plugin-plugins-data-public.irequesttypesmap.md) | |
| [IResponseTypesMap](./kibana-plugin-plugins-data-public.iresponsetypesmap.md) | |
| [ISearchOptions](./kibana-plugin-plugins-data-public.isearchoptions.md) | |
| [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. |
| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) | |
| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | |
| [OptionedValueProp](./kibana-plugin-plugins-data-public.optionedvalueprop.md) | |
| [Query](./kibana-plugin-plugins-data-public.query.md) | |
Expand All @@ -83,6 +79,7 @@
| [RefreshInterval](./kibana-plugin-plugins-data-public.refreshinterval.md) | |
| [SavedQuery](./kibana-plugin-plugins-data-public.savedquery.md) | |
| [SavedQueryService](./kibana-plugin-plugins-data-public.savedqueryservice.md) | |
| [SearchInterceptorDeps](./kibana-plugin-plugins-data-public.searchinterceptordeps.md) | |
| [SearchSourceFields](./kibana-plugin-plugins-data-public.searchsourcefields.md) | |
| [TabbedAggColumn](./kibana-plugin-plugins-data-public.tabbedaggcolumn.md) | \* |
| [TabbedTable](./kibana-plugin-plugins-data-public.tabbedtable.md) | \* |
Expand Down Expand Up @@ -118,7 +115,6 @@
| [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) | |
| [search](./kibana-plugin-plugins-data-public.search.md) | |
| [SearchBar](./kibana-plugin-plugins-data-public.searchbar.md) | |
| [SYNC\_SEARCH\_STRATEGY](./kibana-plugin-plugins-data-public.sync_search_strategy.md) | |
| [syncQueryStateWithUrl](./kibana-plugin-plugins-data-public.syncquerystatewithurl.md) | Helper to setup syncing of global data with the URL |
| [UI\_SETTINGS](./kibana-plugin-plugins-data-public.ui_settings.md) | |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ This class should be instantiated with a `requestTimeout` corresponding with how
<b>Signature:</b>

```typescript
constructor(toasts: ToastsStart, application: ApplicationStart, requestTimeout?: number | undefined);
constructor(deps: SearchInterceptorDeps, requestTimeout?: number | undefined);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toasts | <code>ToastsStart</code> | |
| application | <code>ApplicationStart</code> | |
| deps | <code>SearchInterceptorDeps</code> | |
| requestTimeout | <code>number &#124; undefined</code> | |

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +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; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [toasts](./kibana-plugin-plugins-data-public.searchinterceptor.toasts.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [deps](./kibana-plugin-plugins-data-public.searchinterceptor.deps.md)

## SearchInterceptor.toasts property
## SearchInterceptor.deps property

<b>Signature:</b>

```typescript
protected readonly toasts: ToastsStart;
protected readonly deps: SearchInterceptorDeps;
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Returns an `Observable` over the current number of pending searches. This could
<b>Signature:</b>

```typescript
getPendingCount$: () => import("rxjs").Observable<number>;
getPendingCount$: () => Observable<number>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ export declare class SearchInterceptor

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(toasts, application, requestTimeout)](./kibana-plugin-plugins-data-public.searchinterceptor._constructor_.md) | | This class should be instantiated with a <code>requestTimeout</code> corresponding with how many ms after requests are initiated that they should automatically cancel. |
| [(constructor)(deps, requestTimeout)](./kibana-plugin-plugins-data-public.searchinterceptor._constructor_.md) | | This class should be instantiated with a <code>requestTimeout</code> corresponding with how many ms after requests are initiated that they should automatically cancel. |

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [abortController](./kibana-plugin-plugins-data-public.searchinterceptor.abortcontroller.md) | | <code>AbortController</code> | <code>abortController</code> used to signal all searches to abort. |
| [application](./kibana-plugin-plugins-data-public.searchinterceptor.application.md) | | <code>ApplicationStart</code> | |
| [getPendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.getpendingcount_.md) | | <code>() =&gt; import(&quot;rxjs&quot;).Observable&lt;number&gt;</code> | Returns an <code>Observable</code> over the current number of pending searches. This could mean that one of the search requests is still in flight, or that it has only received partial responses. |
| [deps](./kibana-plugin-plugins-data-public.searchinterceptor.deps.md) | | <code>SearchInterceptorDeps</code> | |
| [getPendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.getpendingcount_.md) | | <code>() =&gt; Observable&lt;number&gt;</code> | Returns an <code>Observable</code> over the current number of pending searches. This could mean that one of the search requests is still in flight, or that it has only received partial responses. |
| [hideToast](./kibana-plugin-plugins-data-public.searchinterceptor.hidetoast.md) | | <code>() =&gt; void</code> | |
| [longRunningToast](./kibana-plugin-plugins-data-public.searchinterceptor.longrunningtoast.md) | | <code>Toast</code> | The current long-running toast (if there is one). |
| [pendingCount](./kibana-plugin-plugins-data-public.searchinterceptor.pendingcount.md) | | <code>number</code> | The number of pending search requests. |
| [pendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.pendingcount_.md) | | <code>BehaviorSubject&lt;number&gt;</code> | Observable that emits when the number of pending requests changes. |
| [requestTimeout](./kibana-plugin-plugins-data-public.searchinterceptor.requesttimeout.md) | | <code>number &#124; undefined</code> | |
| [search](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | <code>(search: ISearchGeneric, request: IKibanaSearchRequest, options?: ISearchOptions &#124; undefined) =&gt; import(&quot;rxjs&quot;).Observable&lt;import(&quot;../../common/search&quot;).IEsSearchResponse&lt;unknown&gt;&gt;</code> | 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 the <code>pendingCount</code> when the request is started/finalized. |
| [showToast](./kibana-plugin-plugins-data-public.searchinterceptor.showtoast.md) | | <code>() =&gt; void</code> | |
| [timeoutSubscriptions](./kibana-plugin-plugins-data-public.searchinterceptor.timeoutsubscriptions.md) | | <code>Set&lt;Subscription&gt;</code> | The subscriptions from scheduling the automatic timeout for each request. |
| [toasts](./kibana-plugin-plugins-data-public.searchinterceptor.toasts.md) | | <code>ToastsStart</code> | |
| [timeoutSubscriptions](./kibana-plugin-plugins-data-public.searchinterceptor.timeoutsubscriptions.md) | | <code>Subscription</code> | The subscriptions from scheduling the automatic timeout for each request. |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [runSearch(request, combinedSignal)](./kibana-plugin-plugins-data-public.searchinterceptor.runsearch.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 the <code>pendingCount</code> when the request is started/finalized. |
| [setupTimers(options)](./kibana-plugin-plugins-data-public.searchinterceptor.setuptimers.md) | | |

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; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [pendingCount](./kibana-plugin-plugins-data-public.searchinterceptor.pendingcount.md)

## SearchInterceptor.pendingCount property

The number of pending search requests.

<b>Signature:</b>

```typescript
protected pendingCount: number;
```
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; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [pendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.pendingcount_.md)

## SearchInterceptor.pendingCount$ property

Observable that emits when the number of pending requests changes.

<b>Signature:</b>

```typescript
protected pendingCount$: BehaviorSubject<number>;
```
Loading