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
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 @@ -93,7 +93,7 @@
},
"dependencies": {
"@elastic/datemath": "link:packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^7.12.0-canary.4",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@7.13.0-canary.1",
"@elastic/ems-client": "7.12.0",
"@elastic/eui": "31.7.0",
"@elastic/filesaver": "1.1.2",
Expand Down
6 changes: 3 additions & 3 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,15 +17,15 @@ export async function emptyKibanaIndexAction({
log,
kbnClient,
}: {
client: Client;
client: KibanaClient;
log: ToolingLog;
kbnClient: KbnClient;
}) {
const stats = createStats('emptyKibanaIndex', log);
const kibanaPluginIds = await kbnClient.plugins.getEnabledIds();

await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await migrateKibanaIndex({ client, kbnClient });
await migrateKibanaIndex({ kbnClient });
stats.createdIndex('.kibana');
return stats.toJSON();
}
6 changes: 3 additions & 3 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 Expand Up @@ -103,7 +103,7 @@ export async function loadAction({

// If we affected the Kibana index, we need to ensure it's migrated...
if (Object.keys(result).some((k) => k.startsWith('.kibana'))) {
await migrateKibanaIndex({ client, kbnClient });
await migrateKibanaIndex({ kbnClient });
log.debug('[%s] Migrated Kibana index after loading Kibana data', name);

if (kibanaPluginIds.includes('spaces')) {
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',
include_type_name: false,
body: {
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 @@ -69,7 +67,6 @@ export function createCreateIndexStream({

await client.indices.create(
{
method: 'PUT',
index,
include_type_name: isPre7Mapping,
body: {
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
Loading