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

ES client : use the new type definitions #83808

Merged
merged 178 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 145 commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
9fa2b78
Use client from branch
joshdover Dec 28, 2020
d2ae74f
Get type checking working in core
joshdover Dec 28, 2020
5106b09
Fix types in other plugins
joshdover Dec 28, 2020
be34ba1
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Jan 15, 2021
6710f81
Update client types + remove type errors from core
joshdover Jan 15, 2021
491bd11
migrate Task Manager Elasticsearch typing from legacy library to clie…
gmmorris Jan 20, 2021
3f179b2
use SortOrder instead o string in alerts
gmmorris Jan 20, 2021
a7fc04b
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Jan 29, 2021
6d99c9c
Update client types + fix core type issues
joshdover Jan 29, 2021
7f153ae
fix maps ts errors
nreese Jan 29, 2021
f2a3c9d
Update Lens types
wylieconlon Jan 29, 2021
a37f2e4
Convert Search Profiler body from a string to an object to conform to…
cjcenizal Jan 29, 2021
58d23f3
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Feb 1, 2021
9057ce7
Fix SOT types
joshdover Feb 1, 2021
526e8ed
Fix/mute Security/Spaces plugins type errors.
azasypkin Feb 2, 2021
0c08a52
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Feb 8, 2021
8e8fc8f
Fix bootstrap types
joshdover Feb 8, 2021
74845ce
Fix painless_lab
joshdover Feb 8, 2021
2b34470
corrected es typing in Event Log
gmmorris Feb 8, 2021
4930e35
Use new types from client for inferred search responses
dgieselaar Feb 1, 2021
9a58724
Latest type defs
dgieselaar Feb 9, 2021
6b71705
Integrate latest type defs for APM/UX
dgieselaar Feb 9, 2021
3d03c93
Merge branch 'master' of github.com:elastic/kibana into new-types-client
dgieselaar Feb 9, 2021
b6d5263
fix core errors
mshustov Mar 1, 2021
422ee42
fix telemetry errors
mshustov Mar 1, 2021
b9c7fd5
fix canvas errors
mshustov Mar 1, 2021
47a0995
fix data_enhanced errors
mshustov Mar 1, 2021
0809609
fix event_log errors
mshustov Mar 1, 2021
6d488ab
mute lens errors
mshustov Mar 1, 2021
790a219
fix or mute maps errors
mshustov Mar 1, 2021
0287242
fix reporting errors
mshustov Mar 1, 2021
f7a1f72
fix security errors
mshustov Mar 1, 2021
b8196eb
mute errors in task_manager
mshustov Mar 1, 2021
674c257
fix errors in telemetry_collection_xpack
mshustov Mar 1, 2021
3f94cb7
merge master, fix conflicts
mshustov Mar 1, 2021
8cfe69e
fix errors in data plugins
mshustov Mar 2, 2021
2ac0615
fix errors in alerts
mshustov Mar 2, 2021
5caca1c
mute errors in index_management
mshustov Mar 2, 2021
f9135fd
fix task_manager errors
mshustov Mar 2, 2021
a5a6e36
mute or fix lens errors
mshustov Mar 2, 2021
63624b0
fix upgrade_assistant errors
mshustov Mar 2, 2021
3c6c7c6
fix or mute errors in index_lifecycle_management
mshustov Mar 2, 2021
938fc56
fix discover errors
mshustov Mar 2, 2021
5748581
fix core tests
mshustov Mar 2, 2021
a03e3d8
Merge branch 'master' into pr/83808
mshustov Mar 2, 2021
354caf0
ML changes
jgowdyelastic Mar 5, 2021
85f8e57
Merge branch 'master' into pr/83808
mshustov Mar 9, 2021
f01ce44
fix core type errors
mshustov Mar 9, 2021
3ebcd33
mute error in kbn-es-archiver
mshustov Mar 9, 2021
23eea1f
fix error in data plugin
mshustov Mar 9, 2021
718321a
fix error in telemetry plugin
mshustov Mar 9, 2021
52f9bd6
fix error in discover
mshustov Mar 9, 2021
dd3a903
fix discover errors
mshustov Mar 9, 2021
39ef08b
fix errors in task_manager
mshustov Mar 9, 2021
34ca800
fix security errors
mshustov Mar 9, 2021
ed39ba6
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 9, 2021
d72a12a
fix wrong conflict resolution
mshustov Mar 9, 2021
ac51d55
address errors with upstream code
mshustov Mar 9, 2021
c85315b
Merge branch 'master' into pr/83808
mshustov Mar 9, 2021
23e027f
update deps to the last commit
mshustov Mar 9, 2021
00a0b26
remove outdated comments
mshustov Mar 9, 2021
87f61de
fix core errors
mshustov Mar 9, 2021
edc2009
fix errors after update
mshustov Mar 9, 2021
a09d2e1
adding more expect errors to ML
jgowdyelastic Mar 10, 2021
a0f5a96
pull the lastest changes
mshustov Mar 10, 2021
4fa0d64
fix core errors
mshustov Mar 10, 2021
b12dd76
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 10, 2021
4ba54cf
fix errors in infra plugin
mshustov Mar 10, 2021
60a71af
fix errors in uptime plugin
mshustov Mar 10, 2021
ce6cebf
fix errors in ml
mshustov Mar 10, 2021
7a88144
fix errors in xpack telemetry
mshustov Mar 10, 2021
fdc4042
fix or mute errors in transform
mshustov Mar 10, 2021
52cf5d6
fix errors in upgrade assistant
mshustov Mar 10, 2021
4ca74c6
fix or mute fleet errors
mshustov Mar 10, 2021
2424c67
start fixing apm errors
mshustov Mar 10, 2021
9e3e5e7
fix errors in osquery
mshustov Mar 10, 2021
d4d6762
fix telemetry tests
mshustov Mar 10, 2021
86f3892
core cleanup
mshustov Mar 11, 2021
372233d
fix asMutableArray imports
mshustov Mar 11, 2021
5287fd6
cleanup
mshustov Mar 11, 2021
83f3966
data_enhanced cleanup
mshustov Mar 11, 2021
bb51050
cleanup events_log
mshustov Mar 11, 2021
1ed809f
cleaup
mshustov Mar 11, 2021
dca9d22
fix error in kbn-es-archiver
mshustov Mar 11, 2021
eeb7dbb
fix errors in kbn-es-archiver
mshustov Mar 11, 2021
07ed8d2
Merge branch 'master' into pr/83808
mshustov Mar 15, 2021
21df2c5
fix errors in kbn-es-archiver
mshustov Mar 15, 2021
d2e42aa
fix ES typings for Hit
mshustov Mar 15, 2021
51bc200
fix SO
mshustov Mar 15, 2021
1b99cf9
fix actions plugin
mshustov Mar 15, 2021
bc7a72e
fix fleet
mshustov Mar 15, 2021
c2d4bef
fix maps
mshustov Mar 15, 2021
2751c08
fix stack_alerts
mshustov Mar 15, 2021
6f8ccb5
fix eslint problems
mshustov Mar 16, 2021
ed95ce4
fix event_log unit tests
mshustov Mar 16, 2021
2e1842d
fix failures in data_enhanced tests
mshustov Mar 16, 2021
7adc3fd
fix test failure in kbn-es-archiver
mshustov Mar 16, 2021
74f670b
fix test failures in index_pattern_management
mshustov Mar 16, 2021
91ceb57
fixing ML test
jgowdyelastic Mar 16, 2021
7392e9f
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 16, 2021
d701a8b
Merge branch 'master' into pr/83808
mshustov Mar 16, 2021
4ea862d
remove outdated comment in kbn-es-archiver
mshustov Mar 16, 2021
1b68394
fix error type in ml
mshustov Mar 16, 2021
c1802e4
fix eslint errors in osquery plugin
mshustov Mar 16, 2021
0e3d505
fix runtime error in infra plugin
mshustov Mar 16, 2021
74b969a
revert changes to event_log cluser exist check
mshustov Mar 16, 2021
f30a0de
fix eslint error in osquery
mshustov Mar 16, 2021
f6eee91
Merge branch 'master' into pr/83808
mshustov Mar 16, 2021
209cf9f
fixing ML endpoint argument types
jgowdyelastic Mar 16, 2021
8b0257f
fx types
joshdover Mar 16, 2021
830ebf2
Update api-extractor docs
joshdover Mar 16, 2021
f8d3375
attempt fix for ese test
joshdover Mar 16, 2021
108fe4a
Fix lint error
dgieselaar Mar 17, 2021
f434eac
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Mar 17, 2021
c911c1c
Fix types for ts refs
joshdover Mar 17, 2021
3029696
Fix data_enhanced unit test
joshdover Mar 17, 2021
24e60f6
fix lens types
joshdover Mar 17, 2021
f080be4
generate docs
joshdover Mar 17, 2021
3934f75
Fix a number of type issues in monitoring and ml
joshdover Mar 17, 2021
1d0d51b
fix triggers_actions_ui
joshdover Mar 17, 2021
7bf6525
Fix ILM functional test
joshdover Mar 17, 2021
506a0d4
Merge remote-tracking branch 'upstream/master' into new-types-client
joshdover Mar 17, 2021
2f40484
Put search.d.ts typings back
joshdover Mar 17, 2021
1abb229
fix data plugin
joshdover Mar 17, 2021
8016d3c
Update typings in typings/elasticsearch
dgieselaar Mar 18, 2021
cc51172
Update snapshots
dgieselaar Mar 18, 2021
823a611
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 19, 2021
935a83f
Merge branch 'master' into pr/83808
mshustov Mar 19, 2021
ad61d56
mute errors in task_manager
mshustov Mar 19, 2021
d9927dc
mute fleet errors
mshustov Mar 19, 2021
1205e0e
lens. remove unnecessary ts-expect-errors
mshustov Mar 19, 2021
d23a93f
fix errors in stack_alerts
mshustov Mar 19, 2021
954b7b7
mute errors in osquery
mshustov Mar 19, 2021
83b55e5
fix errors in security_solution
mshustov Mar 22, 2021
cd53d75
fix errors in lists
mshustov Mar 22, 2021
334c431
fix errors in cases
mshustov Mar 22, 2021
803a2aa
Merge branch 'master' into pr/83808
mshustov Mar 22, 2021
c74ac8c
mute errors in search_examples
mshustov Mar 23, 2021
30d799f
use KibanaClient to enforce promise-based API
mshustov Mar 23, 2021
76a89af
fix errors in test/ folder
mshustov Mar 23, 2021
6f9818a
update comment
mshustov Mar 23, 2021
b32f888
fix errors in x-pack/test folder
mshustov Mar 23, 2021
0cebacc
Merge branch 'master' into pr/83808
mshustov Mar 23, 2021
2a867c4
fix errors in ml plugin
mshustov Mar 23, 2021
1255acc
fix optional fields in ml api_integartoon tests
mshustov Mar 23, 2021
0ba26ec
fix another casting problem in ml tests
mshustov Mar 23, 2021
e3d185b
fix another ml test failure
mshustov Mar 23, 2021
0ed4917
Merge branch 'master' into pr/83808
mshustov Mar 23, 2021
55ad083
fix fleet problem after conflict resolution
mshustov Mar 23, 2021
9627c47
rollback changes in security_solution. trying to fix test
mshustov Mar 23, 2021
77544d5
Update type for discover rows
wylieconlon Mar 23, 2021
1cd710b
uncomment runtime_mappings as its outdated
mshustov Mar 23, 2021
c6b7bef
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 23, 2021
b54e736
address comments from Wylie
mshustov Mar 23, 2021
0a09cc9
remove eslint error due to any
mshustov Mar 23, 2021
fe3f03a
mute error due to incompatibility
mshustov Mar 23, 2021
ddb61c1
Apply suggestions from code review
mshustov Mar 23, 2021
eda8d8b
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 23, 2021
7974cfa
fix type error in lens tests
mshustov Mar 23, 2021
e85c3d4
Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex…
mshustov Mar 23, 2021
3e537f1
Update x-pack/plugins/upgrade_assistant/server/lib/reindexing/reindex…
mshustov Mar 23, 2021
e0553da
update deps
mshustov Mar 24, 2021
a0ecaf9
fix errors in core types
mshustov Mar 24, 2021
a958e93
fix errors for the new elastic/elasticsearch version
mshustov Mar 24, 2021
8da818a
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 24, 2021
078b186
remove unused type
mshustov Mar 24, 2021
d8506bb
remove unnecessary manual type cast and put optional chaining back
mshustov Mar 24, 2021
60951ec
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
d2e04f3
ML: mute Datafeed is missing indices_options
mshustov Mar 24, 2021
3879242
Apply suggestions from code review
mshustov Mar 24, 2021
37bac07
Merge remote-tracking branch 'delvedor/new-types-client' into pr/83808
mshustov Mar 24, 2021
c0e1640
use canary pacakge instead of git commit
mshustov Mar 24, 2021
b83b2d2
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
80f730e
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
370c5db
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
815edf0
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
f353538
Merge branch 'master' into pr/83808
mshustov Mar 24, 2021
b65f197
Merge branch 'master' into pr/83808
mshustov Mar 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export interface SavedObjectsFindOptions
| [preference](./kibana-plugin-core-public.savedobjectsfindoptions.preference.md) | <code>string</code> | An optional ES preference value to be used for the query \* |
| [rootSearchFields](./kibana-plugin-core-public.savedobjectsfindoptions.rootsearchfields.md) | <code>string[]</code> | The fields to perform the parsed query against. Unlike the <code>searchFields</code> argument, these are expected to be root fields and will not be modified. If used in conjunction with <code>searchFields</code>, both are concatenated together. |
| [search](./kibana-plugin-core-public.savedobjectsfindoptions.search.md) | <code>string</code> | Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String <code>query</code> argument for more information |
| [searchAfter](./kibana-plugin-core-public.savedobjectsfindoptions.searchafter.md) | <code>unknown[]</code> | Use the sort values from the previous page to retrieve the next page of results. |
| [searchAfter](./kibana-plugin-core-public.savedobjectsfindoptions.searchafter.md) | <code>estypes.Id[]</code> | Use the sort values from the previous page to retrieve the next page of results. |
| [searchFields](./kibana-plugin-core-public.savedobjectsfindoptions.searchfields.md) | <code>string[]</code> | The fields to perform the parsed query against. See Elasticsearch Simple Query String <code>fields</code> argument for more information |
| [sortField](./kibana-plugin-core-public.savedobjectsfindoptions.sortfield.md) | <code>string</code> | |
| [sortOrder](./kibana-plugin-core-public.savedobjectsfindoptions.sortorder.md) | <code>string</code> | |
| [sortOrder](./kibana-plugin-core-public.savedobjectsfindoptions.sortorder.md) | <code>estypes.SortOrder</code> | |
| [type](./kibana-plugin-core-public.savedobjectsfindoptions.type.md) | <code>string &#124; string[]</code> | |
| [typeToNamespacesMap](./kibana-plugin-core-public.savedobjectsfindoptions.typetonamespacesmap.md) | <code>Map&lt;string, string[] &#124; undefined&gt;</code> | This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the <code>type</code> and <code>namespaces</code> fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. |

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Use the sort values from the previous page to retrieve the next page of results.
<b>Signature:</b>

```typescript
searchAfter?: unknown[];
searchAfter?: estypes.Id[];
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
sortOrder?: string;
sortOrder?: estypes.SortOrder;
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export interface SavedObjectsFindOptions
| [preference](./kibana-plugin-core-server.savedobjectsfindoptions.preference.md) | <code>string</code> | An optional ES preference value to be used for the query \* |
| [rootSearchFields](./kibana-plugin-core-server.savedobjectsfindoptions.rootsearchfields.md) | <code>string[]</code> | The fields to perform the parsed query against. Unlike the <code>searchFields</code> argument, these are expected to be root fields and will not be modified. If used in conjunction with <code>searchFields</code>, both are concatenated together. |
| [search](./kibana-plugin-core-server.savedobjectsfindoptions.search.md) | <code>string</code> | Search documents using the Elasticsearch Simple Query String syntax. See Elasticsearch Simple Query String <code>query</code> argument for more information |
| [searchAfter](./kibana-plugin-core-server.savedobjectsfindoptions.searchafter.md) | <code>unknown[]</code> | Use the sort values from the previous page to retrieve the next page of results. |
| [searchAfter](./kibana-plugin-core-server.savedobjectsfindoptions.searchafter.md) | <code>estypes.Id[]</code> | Use the sort values from the previous page to retrieve the next page of results. |
| [searchFields](./kibana-plugin-core-server.savedobjectsfindoptions.searchfields.md) | <code>string[]</code> | The fields to perform the parsed query against. See Elasticsearch Simple Query String <code>fields</code> argument for more information |
| [sortField](./kibana-plugin-core-server.savedobjectsfindoptions.sortfield.md) | <code>string</code> | |
| [sortOrder](./kibana-plugin-core-server.savedobjectsfindoptions.sortorder.md) | <code>string</code> | |
| [sortOrder](./kibana-plugin-core-server.savedobjectsfindoptions.sortorder.md) | <code>estypes.SortOrder</code> | |
| [type](./kibana-plugin-core-server.savedobjectsfindoptions.type.md) | <code>string &#124; string[]</code> | |
| [typeToNamespacesMap](./kibana-plugin-core-server.savedobjectsfindoptions.typetonamespacesmap.md) | <code>Map&lt;string, string[] &#124; undefined&gt;</code> | This map defines each type to search for, and the namespace(s) to search for the type in; this is only intended to be used by a saved object client wrapper. If this is defined, it supersedes the <code>type</code> and <code>namespaces</code> fields when building the Elasticsearch query. Any types that are not included in this map will be excluded entirely. If a type is included but its value is undefined, the operation will search for that type in the Default namespace. |

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Use the sort values from the previous page to retrieve the next page of results.
<b>Signature:</b>

```typescript
searchAfter?: unknown[];
searchAfter?: estypes.Id[];
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
sortOrder?: string;
sortOrder?: estypes.SortOrder;
```
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export interface SavedObjectsFindResult<T = unknown> extends SavedObject<T>
| Property | Type | Description |
| --- | --- | --- |
| [score](./kibana-plugin-core-server.savedobjectsfindresult.score.md) | <code>number</code> | The Elasticsearch <code>_score</code> of this result. |
| [sort](./kibana-plugin-core-server.savedobjectsfindresult.sort.md) | <code>unknown[]</code> | The Elasticsearch <code>sort</code> value of this result. |
| [sort](./kibana-plugin-core-server.savedobjectsfindresult.sort.md) | <code>string[]</code> | The Elasticsearch <code>sort</code> value of this result. |

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Elasticsearch `sort` value of this result.
<b>Signature:</b>

```typescript
sort?: unknown[];
sort?: string[];
```

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

```typescript
export declare type IEsSearchResponse<Source = any> = IKibanaSearchResponse<SearchResponse<Source>>;
export declare type IEsSearchResponse<Source = any> = IKibanaSearchResponse<estypes.SearchResponse<Source>>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Fetch this source and reject the returned Promise on error
<b>Signature:</b>

```typescript
fetch(options?: ISearchOptions): Promise<import("elasticsearch").SearchResponse<any>>;
fetch(options?: ISearchOptions): Promise<import("@elastic/elasticsearch/api/types").SearchResponse<any>>;
```

## Parameters
Expand All @@ -25,5 +25,5 @@ fetch(options?: ISearchOptions): Promise<import("elasticsearch").SearchResponse<

<b>Returns:</b>

`Promise<import("elasticsearch").SearchResponse<any>>`
`Promise<import("@elastic/elasticsearch/api/types").SearchResponse<any>>`

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

```typescript
export declare type IEsSearchResponse<Source = any> = IKibanaSearchResponse<SearchResponse<Source>>;
export declare type IEsSearchResponse<Source = any> = IKibanaSearchResponse<estypes.SearchResponse<Source>>;
```
3 changes: 2 additions & 1 deletion examples/search_examples/public/search/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export const SearchExamplesApp = ({
setResponse(res.rawResponse);
setTimeTook(res.rawResponse.took);
const avgResult: number | undefined = res.rawResponse.aggregations
? res.rawResponse.aggregations[1].value
? // @ts-expect-error @elastic/elasticsearch no way to declare a type for aggregation in the search response
res.rawResponse.aggregations[1].value
: undefined;
const message = (
<EuiText>
Expand Down
4 changes: 3 additions & 1 deletion examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,15 @@ function doSearch(
const startTs = performance.now();

// Submit the search request using the `data.search` service.
// @ts-expect-error request.params is incompatible. Filter is not assignable to QueryContainer
return data.search
.search(req, { sessionId })
.pipe(
tap((res) => {
if (isCompleteResponse(res)) {
const avgResult: number | undefined = res.rawResponse.aggregations
? res.rawResponse.aggregations[1]?.value ?? res.rawResponse.aggregations[2]?.value
? // @ts-expect-error @elastic/elasticsearch no way to declare a type for aggregation in the search response
res.rawResponse.aggregations[1]?.value ?? res.rawResponse.aggregations[2]?.value
: undefined;
const message = (
<EuiText>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
},
"dependencies": {
"@elastic/datemath": "link:packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.3",
"@elastic/elasticsearch": "github:elastic/elasticsearch-js#type-definitions",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any context on this change? Plans for version management?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a temporary measurement. We are going to release another canary package when this PR is approved.

"@elastic/ems-client": "7.12.0",
"@elastic/eui": "31.7.0",
"@elastic/filesaver": "1.1.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';

Expand All @@ -17,7 +17,7 @@ export async function emptyKibanaIndexAction({
log,
kbnClient,
}: {
client: Client;
client: KibanaClient;
log: ToolingLog;
kbnClient: KbnClient;
}) {
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/actions/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createReadStream } from 'fs';
import { Readable } from 'stream';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { createPromiseFromStreams, concatStreamProviders } from '@kbn/utils';
import { ES_CLIENT_HEADERS } from '../client_headers';

Expand Down Expand Up @@ -48,7 +48,7 @@ export async function loadAction({
name: string;
skipExisting: boolean;
useCreate: boolean;
client: Client;
client: KibanaClient;
dataDir: string;
log: ToolingLog;
kbnClient: KbnClient;
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/actions/save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { resolve } from 'path';
import { createWriteStream, mkdirSync } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';
import { createListStream, createPromiseFromStreams } from '@kbn/utils';

Expand All @@ -32,7 +32,7 @@ export async function saveAction({
}: {
name: string;
indices: string | string[];
client: Client;
client: KibanaClient;
dataDir: string;
log: ToolingLog;
raw: boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/actions/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { resolve } from 'path';
import { createReadStream } from 'fs';
import { Readable, Writable } from 'stream';
import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';
import { createPromiseFromStreams } from '@kbn/utils';
Expand All @@ -32,7 +32,7 @@ export async function unloadAction({
kbnClient,
}: {
name: string;
client: Client;
client: KibanaClient;
dataDir: string;
log: ToolingLog;
kbnClient: KbnClient;
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-archiver/src/client_headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

export const ES_CLIENT_HEADERS = {
'x-elastic-product-origin': 'kibana',
};
} as const;
6 changes: 3 additions & 3 deletions packages/kbn-es-archiver/src/es_archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';
import { KbnClient } from '@kbn/test';

Expand All @@ -20,14 +20,14 @@ import {
} from './actions';

interface Options {
client: Client;
client: KibanaClient;
dataDir: string;
log: ToolingLog;
kbnClient: KbnClient;
}

export class EsArchiver {
private readonly client: Client;
private readonly client: KibanaClient;
private readonly dataDir: string;
private readonly log: ToolingLog;
private readonly kbnClient: KbnClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { Transform } from 'stream';
import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { Stats } from '../stats';
import { Progress } from '../progress';
import { ES_CLIENT_HEADERS } from '../../client_headers';
Expand All @@ -21,7 +21,7 @@ export function createGenerateDocRecordsStream({
progress,
query,
}: {
client: Client;
client: KibanaClient;
stats: Stats;
progress: Progress;
query?: Record<string, any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
* Side Public License, v 1.
*/

import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import AggregateError from 'aggregate-error';
import { Writable } from 'stream';
import { Stats } from '../stats';
import { Progress } from '../progress';
import { ES_CLIENT_HEADERS } from '../../client_headers';

export function createIndexDocRecordsStream(
client: Client,
client: KibanaClient,
stats: Stats,
progress: Progress,
useCreate: boolean = false
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-es-archiver/src/lib/indices/__mocks__/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import sinon from 'sinon';
import { ToolingLog } from '@kbn/dev-utils';
import { Stats } from '../../stats';
Expand Down Expand Up @@ -67,7 +67,7 @@ const createEsClientError = (errorType: string) => {
const indexAlias = (aliases: Record<string, any>, index: string) =>
Object.keys(aliases).find((k) => aliases[k] === index);

type StubClient = Client;
type StubClient = KibanaClient;

export const createStubClient = (
existingIndices: string[] = [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ describe('esArchiver: createCreateIndexStream()', () => {
]);

sinon.assert.calledWith(client.indices.create as sinon.SinonSpy, {
method: 'PUT',
index: 'index',
body: {
settings: undefined,
Expand Down
11 changes: 4 additions & 7 deletions packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import { Transform, Readable } from 'stream';
import { inspect } from 'util';

import { Client } from '@elastic/elasticsearch';
import { estypes } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';

import { Stats } from '../stats';
Expand All @@ -18,12 +19,9 @@ import { deleteIndex } from './delete_index';
import { ES_CLIENT_HEADERS } from '../../client_headers';

interface DocRecord {
value: {
value: estypes.IndexState & {
index: string;
type: string;
settings: Record<string, any>;
mappings: Record<string, any>;
aliases: Record<string, any>;
};
}

Expand All @@ -33,7 +31,7 @@ export function createCreateIndexStream({
skipExisting = false,
log,
}: {
client: Client;
client: KibanaClient;
stats: Stats;
skipExisting?: boolean;
log: ToolingLog;
Expand Down Expand Up @@ -66,7 +64,6 @@ export function createCreateIndexStream({

await client.indices.create(
{
method: 'PUT',
index,
body: {
settings,
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-es-archiver/src/lib/indices/delete_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';
import { Stats } from '../stats';
import { ES_CLIENT_HEADERS } from '../../client_headers';
Expand All @@ -15,7 +15,7 @@ import { ES_CLIENT_HEADERS } from '../../client_headers';
const PENDING_SNAPSHOT_STATUSES = ['INIT', 'STARTED', 'WAITING'];

export async function deleteIndex(options: {
client: Client;
client: KibanaClient;
stats: Stats;
index: string | string[];
log: ToolingLog;
Expand Down Expand Up @@ -84,7 +84,7 @@ export function isDeleteWhileSnapshotInProgressError(error: any) {
* snapshotting this index to complete.
*/
export async function waitForSnapshotCompletion(
client: Client,
client: KibanaClient,
index: string | string[],
log: ToolingLog
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/

import { Transform } from 'stream';
import { Client } from '@elastic/elasticsearch';
import type { KibanaClient } from '@elastic/elasticsearch/api/kibana';
import { ToolingLog } from '@kbn/dev-utils';

import { Stats } from '../stats';
import { deleteIndex } from './delete_index';
import { cleanKibanaIndices } from './kibana_index';

export function createDeleteIndexStream(
client: Client,
client: KibanaClient,
stats: Stats,
log: ToolingLog,
kibanaPluginIds: string[]
Expand Down
Loading