[7.x] Update @elastic/elasticsearch to 8.0.0-canary13 (#98266) (#101595)

* Update @elastic/elasticsearch to 8.0.0-canary13 (#98266)

* bump @elastic/elasticsearch to canary.7

* address errors in core

* address errors in data plugin

* address errors in Alerting team plugins

* remove outdated messages in Lens

* remove unnecessary comments in ML

* address errors in Observability plugin

* address errors in reporting plugin

* address errors in Rule registry plugin

* fix errors in Security plugins

* fix errors in ES-UI plugin

* remove unnecessary union.

* update core tests

* fix kbn-es-archiver

* update to canary 8

* bump to v9

* use new typings

* fix new errors in core

* fix errors in core typeings

* fix type errors in data plugin

* fix type errors in telemetray plugin

* fix data plugin tests

* fix search examples type error

* fix errors in discover plugin

* fix errors in index_pattern_management

* fix type errors in vis_type_*

* fix errors in typings/elasticsearch

* fix type errors in actions plugin

* fix type errors in alerting and apm plugins

* fix type errors in canvas and cases

* fix errors in event_log

* fix type errors in ILM and ingest_pipelines

* fix errors in lens plugin

* fix errors in lists plugin

* fix errors in logstash

* fix errors in metrics_entities

* fix errors in o11y

* fix errors in watcher

* fix errors in uptime

* fix errors in upgrade_assistant

* fix errors in task_manager

* fix errors in stack_alerts

* fix errors in security_solution

* fix errors in rule_registry

* fix errors in snapshot_restore

* fix remaining errors

* fix search intergration tests

* adjust assetion

* bump version to canary.10

* adapt code to new naming schema

* use mapping types provided by the client library

* Revert "adjust assetion"

This reverts commit 19b8fe0464.

* fix so intergration tests

* fix http integration tests

* bump version to canary 11

* fix login test

* fix http integration test

* fix apm test

* update docs

* fixing some ml types

* fix new errors in data plugin

* fix new errors in alerting plugin

* fix new errors in lists plugin

* fix new errors in reporting

* fix or mute errors in rule_registry plugin

* more ML type fixes

* bump to canary 12

* fix errors after merge conflict

* additional ML fixes

* bump to canary 13

* fix errors in apm plugin

* fix errors in fleet plugin

* fix errors in infra plugin

* fix errors in monitoring plugin

* fix errors in osquery plugin

* fix errors in security solution plugins

* fix errors in transform plugin

* Update type imports for ES

* fix errors in x-pack plugins

* fix errors in tests

* update docs

* fix errors in x-pack/test

* update error description

* fix errors after master merge

* update comment in infra plugin

* fix new errors on xpack tests/

Co-authored-by: James Gowdy <jgowdy@elastic.co>
Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
# Conflicts:
#	package.json
#	src/core/server/saved_objects/migrationsv2/integration_tests/migration.test.ts
#	test/common/services/saved_object_info.ts
#	x-pack/plugins/snapshot_restore/server/routes/api/repositories.ts
#	x-pack/plugins/snapshot_restore/server/routes/api/snapshots.ts
#	yarn.lock

* revert  @ts-expect-error changes in infra plugin

* update docs
This commit is contained in:
Mikhail Shustov 2021-06-08 18:21:59 +02:00 committed by GitHub
parent 770ff8c81a
commit 100394cfb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
365 changed files with 840 additions and 1078 deletions

View file

@ -30,7 +30,7 @@ export interface SavedObjectsFindOptions
| [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>estypes.SortOrder</code> | |
| [sortOrder](./kibana-plugin-core-public.savedobjectsfindoptions.sortorder.md) | <code>estypes.SearchSortOrder</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. |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
```

View file

@ -159,8 +159,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsCollectMultiNamespaceReferencesObject](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md) | An object to collect references for. It must be a multi-namespace type (in other words, the object type must be registered with the <code>namespaceType: 'multiple'</code> or <code>namespaceType: 'multiple-isolated'</code> option).<!-- -->Note: if options.purpose is 'updateObjectsSpaces', it must be a shareable type (in other words, the object type must be registered with the <code>namespaceType: 'multiple'</code>). |
| [SavedObjectsCollectMultiNamespaceReferencesOptions](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md) | Options for collecting references. |
| [SavedObjectsCollectMultiNamespaceReferencesResponse](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md) | The response when object references are collected. |
| [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation. |
| [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation. |
| [SavedObjectsCreateOptions](./kibana-plugin-core-server.savedobjectscreateoptions.md) | |
| [SavedObjectsCreatePointInTimeFinderDependencies](./kibana-plugin-core-server.savedobjectscreatepointintimefinderdependencies.md) | |
| [SavedObjectsDeleteByNamespaceOptions](./kibana-plugin-core-server.savedobjectsdeletebynamespaceoptions.md) | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [doc\_values](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.doc_values.md)
## SavedObjectsComplexFieldMapping.doc\_values property
<b>Signature:</b>
```typescript
doc_values?: boolean;
```

View file

@ -1,15 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [dynamic](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md)
## SavedObjectsComplexFieldMapping.dynamic property
The dynamic property of the mapping, either `false` or `'strict'`<!-- -->. If unspecified `dynamic: 'strict'` will be inherited from the top-level index mappings.
Note: To limit the number of mapping fields Saved Object types should \*never\* use `dynamic: true`<!-- -->.
<b>Signature:</b>
```typescript
dynamic?: false | 'strict';
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [enabled](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.enabled.md)
## SavedObjectsComplexFieldMapping.enabled property
<b>Signature:</b>
```typescript
enabled?: boolean;
```

View file

@ -1,24 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md)
## SavedObjectsComplexFieldMapping interface
See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation.
<b>Signature:</b>
```typescript
export interface SavedObjectsComplexFieldMapping
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [doc\_values](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.doc_values.md) | <code>boolean</code> | |
| [dynamic](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.dynamic.md) | <code>false &#124; 'strict'</code> | The dynamic property of the mapping, either <code>false</code> or <code>'strict'</code>. If unspecified <code>dynamic: 'strict'</code> will be inherited from the top-level index mappings.<!-- -->Note: To limit the number of mapping fields Saved Object types should \*never\* use <code>dynamic: true</code>. |
| [enabled](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.enabled.md) | <code>boolean</code> | |
| [properties](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.properties.md) | <code>SavedObjectsMappingProperties</code> | |
| [type](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.type.md) | <code>string</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [properties](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.properties.md)
## SavedObjectsComplexFieldMapping.properties property
<b>Signature:</b>
```typescript
properties: SavedObjectsMappingProperties;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) &gt; [type](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.type.md)
## SavedObjectsComplexFieldMapping.type property
<b>Signature:</b>
```typescript
type?: string;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [doc\_values](./kibana-plugin-core-server.savedobjectscorefieldmapping.doc_values.md)
## SavedObjectsCoreFieldMapping.doc\_values property
<b>Signature:</b>
```typescript
doc_values?: boolean;
```

View file

@ -1,16 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md)
## SavedObjectsCoreFieldMapping.fields property
<b>Signature:</b>
```typescript
fields?: {
[subfield: string]: {
type: string;
ignore_above?: number;
};
};
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md)
## SavedObjectsCoreFieldMapping.index property
<b>Signature:</b>
```typescript
index?: boolean;
```

View file

@ -1,24 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md)
## SavedObjectsCoreFieldMapping interface
See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation.
<b>Signature:</b>
```typescript
export interface SavedObjectsCoreFieldMapping
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [doc\_values](./kibana-plugin-core-server.savedobjectscorefieldmapping.doc_values.md) | <code>boolean</code> | |
| [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | <code>{</code><br/><code> [subfield: string]: {</code><br/><code> type: string;</code><br/><code> ignore_above?: number;</code><br/><code> };</code><br/><code> }</code> | |
| [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | <code>boolean</code> | |
| [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) | <code>number &#124; boolean &#124; string</code> | |
| [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md) | <code>string</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md)
## SavedObjectsCoreFieldMapping.null\_value property
<b>Signature:</b>
```typescript
null_value?: number | boolean | string;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md)
## SavedObjectsCoreFieldMapping.type property
<b>Signature:</b>
```typescript
type: string;
```

View file

@ -11,5 +11,7 @@ Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/el
<b>Signature:</b>
```typescript
export declare type SavedObjectsFieldMapping = SavedObjectsCoreFieldMapping | SavedObjectsComplexFieldMapping;
export declare type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
};
```

View file

@ -30,7 +30,7 @@ export interface SavedObjectsFindOptions
| [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>estypes.SortOrder</code> | |
| [sortOrder](./kibana-plugin-core-server.savedobjectsfindoptions.sortorder.md) | <code>estypes.SearchSortOrder</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. |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
```

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
lang?: string;
lang?: estypes.ScriptLanguage;
```

View file

@ -26,7 +26,7 @@ export interface IFieldType
| [esTypes](./kibana-plugin-plugins-data-public.ifieldtype.estypes.md) | <code>string[]</code> | |
| [filterable](./kibana-plugin-plugins-data-public.ifieldtype.filterable.md) | <code>boolean</code> | |
| [format](./kibana-plugin-plugins-data-public.ifieldtype.format.md) | <code>any</code> | |
| [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) | <code>string</code> | |
| [lang](./kibana-plugin-plugins-data-public.ifieldtype.lang.md) | <code>estypes.ScriptLanguage</code> | |
| [name](./kibana-plugin-plugins-data-public.ifieldtype.name.md) | <code>string</code> | |
| [readFromDocValues](./kibana-plugin-plugins-data-public.ifieldtype.readfromdocvalues.md) | <code>boolean</code> | |
| [script](./kibana-plugin-plugins-data-public.ifieldtype.script.md) | <code>string</code> | |

View file

@ -8,30 +8,22 @@
```typescript
getAggregationRestrictions(): Record<string, Record<string, {
agg?: string | undefined; /**
* Get last saved saved object fields
*/
agg?: string | undefined;
interval?: number | undefined;
fixed_interval?: string | undefined;
calendar_interval?: string | undefined;
delay?: string | undefined;
time_zone?: string | undefined; /**
* Reset last saved saved object fields. used after saving
*/
time_zone?: string | undefined;
}>> | undefined;
```
<b>Returns:</b>
`Record<string, Record<string, {
agg?: string | undefined; /**
* Get last saved saved object fields
*/
agg?: string | undefined;
interval?: number | undefined;
fixed_interval?: string | undefined;
calendar_interval?: string | undefined;
delay?: string | undefined;
time_zone?: string | undefined; /**
* Reset last saved saved object fields. used after saving
*/
time_zone?: string | undefined;
}>> | undefined`

View file

@ -9,7 +9,7 @@ Script field language
<b>Signature:</b>
```typescript
get lang(): string | undefined;
get lang(): "painless" | "expression" | "mustache" | "java" | undefined;
set lang(lang: string | undefined);
set lang(lang: "painless" | "expression" | "mustache" | "java" | undefined);
```

View file

@ -28,7 +28,7 @@ export declare class IndexPatternField implements IFieldType
| [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md) | | <code>string[] &#124; undefined</code> | |
| [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md) | | <code>boolean</code> | |
| [isMapped](./kibana-plugin-plugins-data-public.indexpatternfield.ismapped.md) | | <code>boolean &#124; undefined</code> | Is the field part of the index mapping? |
| [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md) | | <code>string &#124; undefined</code> | Script field language |
| [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md) | | <code>&quot;painless&quot; &#124; &quot;expression&quot; &#124; &quot;mustache&quot; &#124; &quot;java&quot; &#124; undefined</code> | Script field language |
| [name](./kibana-plugin-plugins-data-public.indexpatternfield.name.md) | | <code>string</code> | |
| [readFromDocValues](./kibana-plugin-plugins-data-public.indexpatternfield.readfromdocvalues.md) | | <code>boolean</code> | |
| [runtimeField](./kibana-plugin-plugins-data-public.indexpatternfield.runtimefield.md) | | <code>RuntimeField &#124; undefined</code> | |

View file

@ -10,7 +10,7 @@
toJSON(): {
count: number;
script: string | undefined;
lang: string | undefined;
lang: "painless" | "expression" | "mustache" | "java" | undefined;
conflictDescriptions: Record<string, string[]> | undefined;
name: string;
type: string;
@ -28,7 +28,7 @@ toJSON(): {
`{
count: number;
script: string | undefined;
lang: string | undefined;
lang: "painless" | "expression" | "mustache" | "java" | undefined;
conflictDescriptions: Record<string, string[]> | undefined;
name: string;
type: string;

View file

@ -12,7 +12,7 @@ export declare type PhraseFilter = Filter & {
script?: {
script: {
source?: any;
lang?: string;
lang?: estypes.ScriptLanguage;
params: any;
};
};

View file

@ -12,7 +12,7 @@ export declare type RangeFilter = Filter & EsRangeFilter & {
script?: {
script: {
params: any;
lang: string;
lang: estypes.ScriptLanguage;
source: any;
};
};

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
lang?: string;
lang?: estypes.ScriptLanguage;
```

View file

@ -15,7 +15,7 @@ export interface Reason
| Property | Type | Description |
| --- | --- | --- |
| [caused\_by](./kibana-plugin-plugins-data-public.reason.caused_by.md) | <code>{</code><br/><code> type: string;</code><br/><code> reason: string;</code><br/><code> }</code> | |
| [lang](./kibana-plugin-plugins-data-public.reason.lang.md) | <code>string</code> | |
| [lang](./kibana-plugin-plugins-data-public.reason.lang.md) | <code>estypes.ScriptLanguage</code> | |
| [position](./kibana-plugin-plugins-data-public.reason.position.md) | <code>{</code><br/><code> offset: number;</code><br/><code> start: number;</code><br/><code> end: number;</code><br/><code> }</code> | |
| [reason](./kibana-plugin-plugins-data-public.reason.reason.md) | <code>string</code> | |
| [script\_stack](./kibana-plugin-plugins-data-public.reason.script_stack.md) | <code>string[]</code> | |

View file

@ -7,5 +7,5 @@
<b>Signature:</b>
```typescript
lang?: string;
lang?: estypes.ScriptLanguage;
```

View file

@ -26,7 +26,7 @@ export interface IFieldType
| [esTypes](./kibana-plugin-plugins-data-server.ifieldtype.estypes.md) | <code>string[]</code> | |
| [filterable](./kibana-plugin-plugins-data-server.ifieldtype.filterable.md) | <code>boolean</code> | |
| [format](./kibana-plugin-plugins-data-server.ifieldtype.format.md) | <code>any</code> | |
| [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) | <code>string</code> | |
| [lang](./kibana-plugin-plugins-data-server.ifieldtype.lang.md) | <code>estypes.ScriptLanguage</code> | |
| [name](./kibana-plugin-plugins-data-server.ifieldtype.name.md) | <code>string</code> | |
| [readFromDocValues](./kibana-plugin-plugins-data-server.ifieldtype.readfromdocvalues.md) | <code>boolean</code> | |
| [script](./kibana-plugin-plugins-data-server.ifieldtype.script.md) | <code>string</code> | |

View file

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use runtime field instead
>
Add scripted field to field list

View file

@ -8,30 +8,22 @@
```typescript
getAggregationRestrictions(): Record<string, Record<string, {
agg?: string | undefined; /**
* Get last saved saved object fields
*/
agg?: string | undefined;
interval?: number | undefined;
fixed_interval?: string | undefined;
calendar_interval?: string | undefined;
delay?: string | undefined;
time_zone?: string | undefined; /**
* Reset last saved saved object fields. used after saving
*/
time_zone?: string | undefined;
}>> | undefined;
```
<b>Returns:</b>
`Record<string, Record<string, {
agg?: string | undefined; /**
* Get last saved saved object fields
*/
agg?: string | undefined;
interval?: number | undefined;
fixed_interval?: string | undefined;
calendar_interval?: string | undefined;
delay?: string | undefined;
time_zone?: string | undefined; /**
* Reset last saved saved object fields. used after saving
*/
time_zone?: string | undefined;
}>> | undefined`

View file

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use runtime field instead
>
<b>Signature:</b>

View file

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use runtime field instead
>
<b>Signature:</b>

View file

@ -6,6 +6,7 @@
> Warning: This API is now obsolete.
>
> use runtime field instead
>
Remove scripted field from field list

View file

@ -702,7 +702,7 @@ 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
// @ts-expect-error request.params is incompatible. Filter is not assignable to QueryDslQueryContainer
return data.search
.search(req, { sessionId })
.pipe(

View file

@ -98,7 +98,7 @@
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/charts": "30.0.0",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@7.13.0-canary.1",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@7.14.0-canary.6",
"@elastic/ems-client": "7.13.0",
"@elastic/eui": "33.0.0",
"@elastic/filesaver": "1.1.2",

View file

@ -19,7 +19,7 @@ import { deleteIndex } from './delete_index';
import { ES_CLIENT_HEADERS } from '../../client_headers';
interface DocRecord {
value: estypes.IndexState & {
value: estypes.IndicesIndexState & {
index: string;
type: string;
};

View file

@ -126,7 +126,7 @@ export async function waitForSnapshotCompletion(
const { body: repositoryMap } = await client.snapshot.getRepository({} as any);
for (const repository of Object.keys(repositoryMap)) {
const allInProgress = await getInProgressSnapshots(repository);
const found = allInProgress.find((s: any) => s.indices.includes(index));
const found = allInProgress?.find((s: any) => s.indices.includes(index));
if (!found) {
continue;

View file

@ -36,7 +36,7 @@ export async function deleteKibanaIndices({
await client.indices.putSettings(
{
index: indexNames,
body: { index: { blocks: { read_only: false } } },
body: { settings: { blocks: { read_only: false } } },
},
{
headers: ES_CLIENT_HEADERS,
@ -126,7 +126,7 @@ export async function cleanKibanaIndices({
},
},
},
} as estypes.QueryContainer,
} as estypes.QueryDslQueryContainer,
},
},
{

View file

@ -1249,7 +1249,7 @@ export interface SavedObjectsCreateOptions {
// @public (undocumented)
export interface SavedObjectsFindOptions {
// @alpha
aggs?: Record<string, estypes.AggregationContainer>;
aggs?: Record<string, estypes.AggregationsAggregationContainer>;
defaultSearchOperator?: 'AND' | 'OR';
fields?: string[];
// Warning: (ae-forgotten-export) The symbol "KueryNode" needs to be exported by the entry point index.d.ts
@ -1275,7 +1275,7 @@ export interface SavedObjectsFindOptions {
// (undocumented)
sortField?: string;
// (undocumented)
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
// (undocumented)
type: string | string[];
typeToNamespacesMap?: Map<string, string[] | undefined>;

View file

@ -31,7 +31,7 @@ export interface PollEsNodesVersionOptions {
interface NodeInfo {
version: string;
ip: string;
http: {
http?: {
publish_address: string;
};
name: string;

View file

@ -405,7 +405,7 @@ describe('http service', () => {
const { body } = await kbnTestServer.request.get(root, '/new-platform/').expect(400);
expect(body.message).toEqual('[error_type]: error_reason');
expect(body.message).toMatch('[error_type]: error_reason');
});
});
});

View file

@ -339,8 +339,6 @@ export type {
SavedObjectsDeleteByNamespaceOptions,
SavedObjectsIncrementCounterOptions,
SavedObjectsIncrementCounterField,
SavedObjectsComplexFieldMapping,
SavedObjectsCoreFieldMapping,
SavedObjectsFieldMapping,
SavedObjectsTypeMappingDefinition,
SavedObjectsMappingProperties,

View file

@ -72,8 +72,6 @@ export type {
} from './service/lib/repository';
export type {
SavedObjectsCoreFieldMapping,
SavedObjectsComplexFieldMapping,
SavedObjectsFieldMapping,
SavedObjectsMappingProperties,
SavedObjectsTypeMappingDefinition,

View file

@ -8,8 +8,6 @@
export { getTypes, getProperty, getRootProperties, getRootPropertiesObjects } from './lib';
export type {
SavedObjectsComplexFieldMapping,
SavedObjectsCoreFieldMapping,
SavedObjectsTypeMappingDefinition,
SavedObjectsTypeMappingDefinitions,
SavedObjectsMappingProperties,

View file

@ -34,7 +34,7 @@ const MAPPINGS = {
},
},
},
};
} as const;
function runTest(key: string | string[], mapping: IndexMapping | SavedObjectsFieldMapping) {
expect(typeof key === 'string' || Array.isArray(key)).toBeTruthy();

View file

@ -7,7 +7,7 @@
*/
import { toPath } from 'lodash';
import { SavedObjectsCoreFieldMapping, SavedObjectsFieldMapping, IndexMapping } from '../types';
import { SavedObjectsFieldMapping, IndexMapping } from '../types';
function getPropertyMappingFromObjectMapping(
mapping: IndexMapping | SavedObjectsFieldMapping,
@ -15,7 +15,7 @@ function getPropertyMappingFromObjectMapping(
): SavedObjectsFieldMapping | undefined {
const props =
(mapping && (mapping as IndexMapping).properties) ||
(mapping && (mapping as SavedObjectsCoreFieldMapping).fields);
(mapping && (mapping as SavedObjectsFieldMapping).fields);
if (!props) {
return undefined;

View file

@ -15,7 +15,7 @@ test(`returns single object with properties`, () => {
properties: {},
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
@ -32,7 +32,7 @@ test(`returns single object with type === 'object'`, () => {
type: 'object',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
@ -75,7 +75,7 @@ test(`returns two objects with type === 'object'`, () => {
type: 'object',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
@ -95,7 +95,7 @@ test(`excludes objects without properties and type of keyword`, () => {
type: 'keyword',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({});
@ -111,7 +111,7 @@ test(`excludes two objects without properties and type of keyword`, () => {
type: 'keyword',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({});
@ -127,7 +127,7 @@ test(`includes one object with properties and excludes one object without proper
type: 'keyword',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
@ -147,7 +147,7 @@ test(`includes one object with type === 'object' and excludes one object without
type: 'keyword',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
@ -170,7 +170,7 @@ test('excludes references and migrationVersion which are part of the blacklist',
type: 'object',
},
},
};
} as const;
const result = getRootPropertiesObjects(mappings);
expect(result).toEqual({
foo: {

View file

@ -6,11 +6,7 @@
* Side Public License, v 1.
*/
import {
SavedObjectsComplexFieldMapping,
IndexMapping,
SavedObjectsMappingProperties,
} from '../types';
import { SavedObjectsFieldMapping, IndexMapping, SavedObjectsMappingProperties } from '../types';
import { getRootProperties } from './get_root_properties';
/**
@ -36,7 +32,7 @@ export function getRootPropertiesObjects(mappings: IndexMapping) {
// we consider the existence of the properties or type of object to designate that this is an object datatype
if (
!omittedRootProps.includes(key) &&
((value as SavedObjectsComplexFieldMapping).properties || value.type === 'object')
((value as SavedObjectsFieldMapping).properties || value.type === 'object')
) {
acc[key] = value;
}

View file

@ -6,6 +6,7 @@
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
/**
* Describe a saved object type mapping.
*
@ -96,9 +97,17 @@ export interface SavedObjectsMappingProperties {
*
* @public
*/
export type SavedObjectsFieldMapping =
| SavedObjectsCoreFieldMapping
| SavedObjectsComplexFieldMapping;
export type SavedObjectsFieldMapping = estypes.MappingProperty & {
/**
* The dynamic property of the mapping, either `false` or `'strict'`. If
* unspecified `dynamic: 'strict'` will be inherited from the top-level
* index mappings.
*
* Note: To limit the number of mapping fields Saved Object types should
* *never* use `dynamic: true`.
*/
dynamic?: false | 'strict';
};
/** @internal */
export interface IndexMapping {
@ -114,42 +123,3 @@ export interface IndexMappingMeta {
// the md5 hash of that mapping's value when the index was created.
migrationMappingPropertyHashes?: { [k: string]: string };
}
/**
* See {@link SavedObjectsFieldMapping} for documentation.
*
* @public
*/
export interface SavedObjectsCoreFieldMapping {
type: string;
null_value?: number | boolean | string;
index?: boolean;
doc_values?: boolean;
fields?: {
[subfield: string]: {
type: string;
ignore_above?: number;
};
};
}
/**
* See {@link SavedObjectsFieldMapping} for documentation.
*
* @public
*/
export interface SavedObjectsComplexFieldMapping {
/**
* The dynamic property of the mapping, either `false` or `'strict'`. If
* unspecified `dynamic: 'strict'` will be inherited from the top-level
* index mappings.
*
* Note: To limit the number of mapping fields Saved Object types should
* *never* use `dynamic: true`.
*/
dynamic?: false | 'strict';
enabled?: boolean;
doc_values?: boolean;
type?: string;
properties: SavedObjectsMappingProperties;
}

View file

@ -19,19 +19,19 @@ describe('buildActiveMappings', () => {
const properties = {
aaa: { type: 'text' },
bbb: { type: 'long' },
};
} as const;
expect(buildActiveMappings(properties)).toMatchSnapshot();
});
test('disallows duplicate mappings', () => {
const properties = { type: { type: 'long' } };
const properties = { type: { type: 'long' } } as const;
expect(() => buildActiveMappings(properties)).toThrow(/Cannot redefine core mapping \"type\"/);
});
test('disallows mappings with leading underscore', () => {
const properties = { _hm: { type: 'keyword' } };
const properties = { _hm: { type: 'keyword' } } as const;
expect(() => buildActiveMappings(properties)).toThrow(
/Invalid mapping \"_hm\"\. Mappings cannot start with _/
@ -60,7 +60,7 @@ describe('buildActiveMappings', () => {
aaa: { type: 'keyword', fields: { a: { type: 'keyword' }, b: { type: 'text' } } },
bbb: { fields: { b: { type: 'text' }, a: { type: 'keyword' } }, type: 'keyword' },
ccc: { fields: { b: { type: 'text' }, a: { type: 'text' } }, type: 'keyword' },
};
} as const;
const mappings = buildActiveMappings(properties);
const hashes = mappings._meta!.migrationMappingPropertyHashes!;

View file

@ -36,7 +36,7 @@ test('mappings without index pattern goes to default index', () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -48,7 +48,7 @@ test('mappings without index pattern goes to default index', () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -69,7 +69,7 @@ test(`mappings with custom index pattern doesn't go to default index`, () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -81,7 +81,7 @@ test(`mappings with custom index pattern doesn't go to default index`, () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -103,7 +103,7 @@ test('creating a script gets added to the index pattern', () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -116,7 +116,7 @@ test('creating a script gets added to the index pattern', () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
@ -144,18 +144,18 @@ test('throws when two scripts are defined for an index pattern', () => {
type1: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
type2: {
properties: {
field1: {
type: 'string',
type: 'text',
},
},
},
};
} as const;
expect(() =>
createIndexMap({
kibanaIndexName: defaultIndex,

View file

@ -40,10 +40,10 @@ describe('ElasticIndex', () => {
return elasticsearchClientMock.createSuccessTransportRequestPromise({
[index]: {
aliases: { foo: index },
mappings: { dynamic: 'strict', properties: { a: 'b' } },
mappings: { dynamic: 'strict', properties: { a: 'b' } as any },
settings: {},
},
} as estypes.GetIndexResponse);
} as estypes.IndicesGetResponse);
});
const info = await Index.fetchInfo(client, '.baz');
@ -164,7 +164,7 @@ describe('ElasticIndex', () => {
client.tasks.get.mockResolvedValue(
elasticsearchClientMock.createSuccessTransportRequestPromise({
completed: true,
} as estypes.GetTaskResponse)
} as estypes.TaskGetResponse)
);
const info = {
@ -175,7 +175,7 @@ describe('ElasticIndex', () => {
dynamic: 'strict' as const,
properties: { foo: { type: 'keyword' } },
},
};
} as const;
await Index.convertToAlias(
client,
@ -248,7 +248,7 @@ describe('ElasticIndex', () => {
reason: 'all shards failed',
failed_shards: [],
},
} as estypes.GetTaskResponse)
} as estypes.TaskGetResponse)
);
const info = {

View file

@ -32,7 +32,7 @@ export interface FullIndexInfo {
// saved objects which are no longer used. These saved objects will still be
// kept in the outdated index for backup purposes, but won't be available in
// the upgraded index.
export const excludeUnusedTypesQuery: estypes.QueryContainer = {
export const excludeUnusedTypesQuery: estypes.QueryDslQueryContainer = {
bool: {
must_not: [
// https://github.com/elastic/kibana/issues/91869
@ -401,7 +401,6 @@ async function reindex(
task_id: String(task),
});
// @ts-expect-error @elastic/elasticsearch GetTaskResponse doesn't contain `error` property
const e = body.error;
if (e) {
throw new Error(`Re-index failed [${e.type}] ${e.reason} :: ${JSON.stringify(e)}`);

View file

@ -450,7 +450,7 @@ function withIndex(
client.tasks.get.mockReturnValue(
elasticsearchClientMock.createSuccessTransportRequestPromise({
completed: true,
} as estypes.GetTaskResponse)
} as estypes.TaskGetResponse)
);
client.search.mockReturnValue(
elasticsearchClientMock.createSuccessTransportRequestPromise(searchResult(0) as any)

View file

@ -31,7 +31,7 @@ describe('disableUnknownTypeMappingFields', () => {
},
},
},
};
} as const;
const activeMappings = {
_meta: {
migrationMappingPropertyHashes: {
@ -46,7 +46,7 @@ describe('disableUnknownTypeMappingFields', () => {
},
},
},
};
} as const;
const targetMappings = disableUnknownTypeMappingFields(activeMappings, sourceMappings);
it('disables complex field mappings from unknown types in the source mappings', () => {

View file

@ -320,7 +320,11 @@ const mockV2MigrationOptions = () => {
)
);
options.client.indices.addBlock.mockReturnValue(
elasticsearchClientMock.createSuccessTransportRequestPromise({ acknowledged: true })
elasticsearchClientMock.createSuccessTransportRequestPromise({
acknowledged: true,
shards_acknowledged: true,
indices: [],
})
);
options.client.reindex.mockReturnValue(
elasticsearchClientMock.createSuccessTransportRequestPromise({
@ -333,7 +337,7 @@ const mockV2MigrationOptions = () => {
error: undefined,
failures: [],
task: { description: 'task description' } as any,
} as estypes.GetTaskResponse)
} as estypes.TaskGetResponse)
);
options.client.search = jest

View file

@ -24,8 +24,8 @@ import {
} from './constants';
import { waitForIndexStatusYellow } from './wait_for_index_status_yellow';
function aliasArrayToRecord(aliases: string[]): Record<string, estypes.Alias> {
const result: Record<string, estypes.Alias> = {};
function aliasArrayToRecord(aliases: string[]): Record<string, estypes.IndicesAlias> {
const result: Record<string, estypes.IndicesAlias> = {};
for (const alias of aliases) {
result[alias] = {};
}

View file

@ -242,9 +242,7 @@ describe('migration actions', () => {
it('rejects if there is a non-retryable error', async () => {
expect.assertions(1);
const task = removeWriteBlock({ client, index: 'no_such_index' });
await expect(task()).rejects.toMatchInlineSnapshot(
`[ResponseError: index_not_found_exception]`
);
await expect(task()).rejects.toThrow('index_not_found_exception');
});
});
@ -264,7 +262,7 @@ describe('migration actions', () => {
// Allocate 1 replica so that this index stays yellow
number_of_replicas: '1',
// Disable all shard allocation so that the index status is red
index: { routing: { allocation: { enable: 'none' } } },
routing: { allocation: { enable: 'none' } },
},
},
},
@ -284,7 +282,7 @@ describe('migration actions', () => {
index: 'red_then_yellow_index',
body: {
// Enable all shard allocation so that the index status turns yellow
index: { routing: { allocation: { enable: 'all' } } },
settings: { routing: { allocation: { enable: 'all' } } },
},
});
@ -354,7 +352,7 @@ describe('migration actions', () => {
index: 'clone_red_then_yellow_index',
body: {
// Enable all shard allocation so that the index status goes yellow
index: { routing: { allocation: { enable: 'all' } } },
settings: { routing: { allocation: { enable: 'all' } } },
},
});
indexYellow = true;
@ -859,9 +857,7 @@ describe('migration actions', () => {
sourceIndex: 'no_such_index',
targetIndex: 'existing_index_2',
});
await expect(task()).rejects.toMatchInlineSnapshot(
`[ResponseError: index_not_found_exception]`
);
await expect(task()).rejects.toThrow('index_not_found_exception');
task = verifyReindex({
client,
@ -1142,10 +1138,7 @@ describe('migration actions', () => {
timeout: '10s',
});
await expect(task()).rejects.toMatchInlineSnapshot(`
[Error: pickupUpdatedMappings task failed with the following error:
{"type":"index_not_found_exception","reason":"no such index [no_such_index]","resource.type":"index_or_alias","resource.id":"no_such_index","index_uuid":"_na_","index":"no_such_index"}]
`);
await expect(task()).rejects.toThrow('index_not_found_exception');
});
it('resolves left wait_for_task_completion_timeout when the task does not complete within the timeout', async () => {
const res = (await pickupUpdatedMappings(
@ -1433,7 +1426,7 @@ describe('migration actions', () => {
index: 'red_then_yellow_index',
body: {
// Disable all shard allocation so that the index status is red
index: { routing: { allocation: { enable: 'all' } } },
settings: { routing: { allocation: { enable: 'all' } } },
},
});
indexYellow = true;
@ -1455,7 +1448,7 @@ describe('migration actions', () => {
// failure
await expect(
createIndex({ client, indexName: 'existing_index_2_alias', mappings: undefined as any })()
).rejects.toMatchInlineSnapshot(`[ResponseError: invalid_index_name_exception]`);
).rejects.toThrow('invalid_index_name_exception');
});
});

View file

@ -28,7 +28,7 @@ export interface ReadWithPit {
export interface ReadWithPitParams {
client: ElasticsearchClient;
pitId: string;
query: estypes.QueryContainer;
query: estypes.QueryDslQueryContainer;
batchSize: number;
searchAfter?: number[];
seqNoPrimaryTerm?: boolean;

View file

@ -32,7 +32,7 @@ export interface ReindexParams {
* are no longer used. These saved objects will still be kept in the outdated
* index for backup purposes, but won't be available in the upgraded index.
*/
unusedTypesQuery: estypes.QueryContainer;
unusedTypesQuery: estypes.QueryDslQueryContainer;
}
/**
* Reindex documents from the `sourceIndex` into the `targetIndex`. Returns a

View file

@ -39,7 +39,7 @@ export const removeWriteBlock = ({
// Don't change any existing settings
preserve_existing: true,
body: {
index: {
settings: {
blocks: {
write: false,
},

View file

@ -24,7 +24,7 @@ export interface SearchResponse {
export interface SearchForOutdatedDocumentsOptions {
batchSize: number;
targetIndex: string;
outdatedDocumentsQuery?: estypes.QueryContainer;
outdatedDocumentsQuery?: estypes.QueryDslQueryContainer;
}
/**

View file

@ -42,7 +42,7 @@ export const waitForReindexTask = flow(
if (res.error.value.type === 'index_not_found_exception') {
return TaskEither.left({
type: 'index_not_found_exception' as const,
index: res.error.value.index,
index: res.error.value.index!,
});
} else {
throw new Error('Reindex failed with the following error:\n' + JSON.stringify(res.error));

View file

@ -16,7 +16,7 @@ import {
} from './catch_retryable_es_client_errors';
/** @internal */
export interface WaitForTaskResponse {
error: Option.Option<{ type: string; reason: string; index: string }>;
error: Option.Option<{ type: string; reason: string; index?: string }>;
completed: boolean;
failures: Option.Option<any[]>;
description?: string;
@ -84,7 +84,6 @@ export const waitForTask = ({
const failures = body.response?.failures ?? [];
return Either.right({
completed: body.completed,
// @ts-expect-error @elastic/elasticsearch GetTaskResponse doesn't declare `error` property
error: Option.fromNullable(body.error),
failures: failures.length > 0 ? Option.some(failures) : Option.none,
description: body.task.description,

View file

@ -157,7 +157,10 @@ describe('migration v2', () => {
const response = body[migratedIndex];
expect(response).toBeDefined();
expect(Object.keys(response.aliases).sort()).toEqual(['.kibana', `.kibana_${kibanaVersion}`]);
expect(Object.keys(response.aliases!).sort()).toEqual([
'.kibana',
`.kibana_${kibanaVersion}`,
]);
});
it('copies all the document of the previous index to the new one', async () => {

View file

@ -244,7 +244,7 @@ describe('migrations v2 model', () => {
disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
},
},
};
} as const;
test('INIT -> OUTDATED_DOCUMENTS_SEARCH_OPEN_PIT if .kibana is already pointing to the target index', () => {
const res: ResponseType<'INIT'> = Either.right({
@ -683,7 +683,7 @@ describe('migrations v2 model', () => {
disabled_saved_object_type: '7997cf5a56cc02bdc9c93361bde732b0',
},
},
};
} as const;
const waitForYellowSourceState: WaitForYellowSourceState = {
...baseState,

View file

@ -53,7 +53,7 @@ export interface BaseState extends ControlState {
readonly tempIndexMappings: IndexMapping;
/** Script to apply to a legacy index before it can be used as a migration source */
readonly preMigrationScript: Option.Option<string>;
readonly outdatedDocumentsQuery: estypes.QueryContainer;
readonly outdatedDocumentsQuery: estypes.QueryDslQueryContainer;
readonly retryCount: number;
readonly retryDelay: number;
/**
@ -112,7 +112,7 @@ export interface BaseState extends ControlState {
* are no longer used. These saved objects will still be kept in the outdated
* index for backup purposes, but won't be available in the upgraded index.
*/
readonly unusedTypesQuery: estypes.QueryContainer;
readonly unusedTypesQuery: estypes.QueryDslQueryContainer;
}
export interface InitState extends BaseState {
@ -132,7 +132,7 @@ export interface PostInitState extends BaseState {
/** The target index is the index to which the migration writes */
readonly targetIndex: string;
readonly versionIndexReadyActions: Option.Option<AliasAction[]>;
readonly outdatedDocumentsQuery: estypes.QueryContainer;
readonly outdatedDocumentsQuery: estypes.QueryDslQueryContainer;
}
export interface DoneState extends PostInitState {

View file

@ -33,7 +33,7 @@ export class SavedObjectTypeRegistry {
throw new Error(`Type '${type.name}' is already registered`);
}
validateType(type);
this.types.set(type.name, deepFreeze(type));
this.types.set(type.name, deepFreeze(type) as SavedObjectsType);
}
/**

View file

@ -9,7 +9,7 @@
import type { estypes } from '@elastic/elasticsearch';
import { validateAndConvertAggregations } from './validation';
type AggsMap = Record<string, estypes.AggregationContainer>;
type AggsMap = Record<string, estypes.AggregationsAggregationContainer>;
const mockMappings = {
properties: {
@ -19,7 +19,9 @@ const mockMappings = {
references: {
type: 'nested',
properties: {
id: 'keyword',
id: {
type: 'keyword',
},
},
},
foo: {
@ -31,7 +33,7 @@ const mockMappings = {
type: 'text',
},
bytes: {
type: 'number',
type: 'integer',
},
},
},
@ -73,7 +75,7 @@ const mockMappings = {
},
},
},
};
} as const;
describe('validateAndConvertAggregations', () => {
it('validates a simple aggregations', () => {

View file

@ -37,9 +37,9 @@ interface ValidationContext {
*/
export const validateAndConvertAggregations = (
allowedTypes: string[],
aggs: Record<string, estypes.AggregationContainer>,
aggs: Record<string, estypes.AggregationsAggregationContainer>,
indexMapping: IndexMapping
): Record<string, estypes.AggregationContainer> => {
): Record<string, estypes.AggregationsAggregationContainer> => {
return validateAggregations(aggs, {
allowedTypes,
indexMapping,
@ -53,16 +53,15 @@ export const validateAndConvertAggregations = (
* Or a nested record of aggregation (`SearchRequest.body.aggs.myAggregation.aggs`)
*/
const validateAggregations = (
aggregations: Record<string, estypes.AggregationContainer>,
aggregations: Record<string, estypes.AggregationsAggregationContainer>,
context: ValidationContext
) => {
return Object.entries(aggregations).reduce<Record<string, estypes.AggregationContainer>>(
(memo, [aggrName, aggrContainer]) => {
memo[aggrName] = validateAggregation(aggrContainer, childContext(context, aggrName));
return memo;
},
{}
);
return Object.entries(aggregations).reduce<
Record<string, estypes.AggregationsAggregationContainer>
>((memo, [aggrName, aggrContainer]) => {
memo[aggrName] = validateAggregation(aggrContainer, childContext(context, aggrName));
return memo;
}, {});
};
/**
@ -70,7 +69,7 @@ const validateAggregations = (
* from a nested aggregation record, including its potential nested aggregations.
*/
const validateAggregation = (
aggregation: estypes.AggregationContainer,
aggregation: estypes.AggregationsAggregationContainer,
context: ValidationContext
) => {
const container = validateAggregationContainer(aggregation, context);
@ -93,10 +92,10 @@ const validateAggregation = (
* (ignoring its nested aggregations)
*/
const validateAggregationContainer = (
container: estypes.AggregationContainer,
container: estypes.AggregationsAggregationContainer,
context: ValidationContext
) => {
return Object.entries(container).reduce<estypes.AggregationContainer>(
return Object.entries(container).reduce<estypes.AggregationsAggregationContainer>(
(memo, [aggName, aggregation]) => {
if (aggregationKeys.includes(aggName)) {
return memo;

View file

@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
import { IndexMapping } from '../../../mappings';
import {
isRootLevelAttribute,
rewriteRootLevelAttribute,
@ -14,7 +13,7 @@ import {
rewriteObjectTypeAttribute,
} from './validation_utils';
const mockMappings: IndexMapping = {
const mockMappings = {
properties: {
updated_at: {
type: 'date',
@ -28,7 +27,7 @@ const mockMappings: IndexMapping = {
type: 'text',
},
bytes: {
type: 'number',
type: 'integer',
},
},
},
@ -70,7 +69,7 @@ const mockMappings: IndexMapping = {
},
},
},
};
} as const;
describe('isRootLevelAttribute', () => {
it('returns true when referring to a path to a valid root level field', () => {

View file

@ -31,7 +31,7 @@ const mockMappings = {
type: 'text',
},
bytes: {
type: 'number',
type: 'integer',
},
},
},
@ -90,7 +90,7 @@ const mockMappings = {
},
},
},
};
} as const;
describe('Filter Utils', () => {
describe('#validateConvertFilterToKueryNode', () => {

View file

@ -672,7 +672,6 @@ export class SavedObjectsRepository {
}
const deleteDocNotFound = body.result === 'not_found';
// @ts-expect-error 'error' does not exist on type 'DeleteResponse'
const deleteIndexNotFound = body.error && body.error.type === 'index_not_found_exception';
if (deleteDocNotFound || deleteIndexNotFound) {
// see "404s from missing index" above
@ -897,7 +896,7 @@ export class SavedObjectsRepository {
per_page: perPage,
total: body.hits.total,
saved_objects: body.hits.hits.map(
(hit: estypes.Hit<SavedObjectsRawDocSource>): SavedObjectsFindResult => ({
(hit: estypes.SearchHit<SavedObjectsRawDocSource>): SavedObjectsFindResult => ({
// @ts-expect-error @elastic/elasticsearch declared Id as string | number
...this._rawToSavedObject(hit),
score: hit._score!,
@ -1835,13 +1834,9 @@ export class SavedObjectsRepository {
...(preference ? { preference } : {}),
};
const { body, statusCode } = await this.client.openPointInTime(
// @ts-expect-error @elastic/elasticsearch OpenPointInTimeRequest.index expected to accept string[]
esOptions,
{
ignore: [404],
}
);
const { body, statusCode } = await this.client.openPointInTime(esOptions, {
ignore: [404],
});
if (statusCode === 404) {
throw SavedObjectsErrorHelpers.createGenericNotFoundError();
}

View file

@ -26,7 +26,7 @@ interface GetSearchDslOptions {
rootSearchFields?: string[];
searchAfter?: estypes.Id[];
sortField?: string;
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
namespaces?: string[];
pit?: SavedObjectsPitParams;
typeToNamespacesMap?: Map<string, string[] | undefined>;

View file

@ -50,7 +50,7 @@ const MAPPINGS = {
},
},
},
};
} as const;
describe('searchDsl/getSortParams', () => {
describe('type, no sortField', () => {

View file

@ -16,8 +16,8 @@ export function getSortingParams(
mappings: IndexMapping,
type: string | string[],
sortField?: string,
sortOrder?: estypes.SortOrder
): { sort?: estypes.SortContainer[] } {
sortOrder?: estypes.SearchSortOrder
): { sort?: estypes.SearchSortContainer[] } {
if (!sortField) {
return {};
}

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import type { BulkOperationContainer, MultiGetOperation } from '@elastic/elasticsearch/api/types';
import type { estypes } from '@elastic/elasticsearch';
import intersection from 'lodash/intersection';
import type { ISavedObjectTypeRegistry } from '../../saved_objects_type_registry';
@ -173,7 +173,7 @@ export async function updateObjectsSpaces({
};
});
const bulkGetDocs = expectedBulkGetResults.reduce<MultiGetOperation[]>((acc, x) => {
const bulkGetDocs = expectedBulkGetResults.reduce<estypes.MgetOperation[]>((acc, x) => {
if (isRight(x) && x.value.esRequestIndex !== undefined) {
acc.push({
_id: serializer.generateRawId(undefined, x.value.type, x.value.id),
@ -192,7 +192,7 @@ export async function updateObjectsSpaces({
const time = new Date().toISOString();
let bulkOperationRequestIndexCounter = 0;
const bulkOperationParams: BulkOperationContainer[] = [];
const bulkOperationParams: estypes.BulkOperationContainer[] = [];
const expectedBulkOperationResults: Either[] = expectedBulkGetResults.map(
(expectedBulkGetResult) => {
if (isLeft(expectedBulkGetResult)) {

View file

@ -80,7 +80,7 @@ export interface SavedObjectsFindOptions {
page?: number;
perPage?: number;
sortField?: string;
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
/**
* An array of fields to include in the results
* @example
@ -137,7 +137,7 @@ export interface SavedObjectsFindOptions {
*
* @alpha
*/
aggs?: Record<string, estypes.AggregationContainer>;
aggs?: Record<string, estypes.AggregationsAggregationContainer>;
namespaces?: string[];
/**
* 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

View file

@ -2361,38 +2361,6 @@ export interface SavedObjectsCollectMultiNamespaceReferencesResponse {
objects: SavedObjectReferenceWithContext[];
}
// @public
export interface SavedObjectsComplexFieldMapping {
// (undocumented)
doc_values?: boolean;
dynamic?: false | 'strict';
// (undocumented)
enabled?: boolean;
// (undocumented)
properties: SavedObjectsMappingProperties;
// (undocumented)
type?: string;
}
// @public
export interface SavedObjectsCoreFieldMapping {
// (undocumented)
doc_values?: boolean;
// (undocumented)
fields?: {
[subfield: string]: {
type: string;
ignore_above?: number;
};
};
// (undocumented)
index?: boolean;
// (undocumented)
null_value?: number | boolean | string;
// (undocumented)
type: string;
}
// @public (undocumented)
export interface SavedObjectsCreateOptions extends SavedObjectsBaseOptions {
coreMigrationVersion?: string;
@ -2554,12 +2522,14 @@ export interface SavedObjectsExportTransformContext {
}
// @public
export type SavedObjectsFieldMapping = SavedObjectsCoreFieldMapping | SavedObjectsComplexFieldMapping;
export type SavedObjectsFieldMapping = estypes.MappingProperty & {
dynamic?: false | 'strict';
};
// @public (undocumented)
export interface SavedObjectsFindOptions {
// @alpha
aggs?: Record<string, estypes.AggregationContainer>;
aggs?: Record<string, estypes.AggregationsAggregationContainer>;
defaultSearchOperator?: 'AND' | 'OR';
fields?: string[];
// Warning: (ae-forgotten-export) The symbol "KueryNode" needs to be exported by the entry point index.d.ts
@ -2583,7 +2553,7 @@ export interface SavedObjectsFindOptions {
// (undocumented)
sortField?: string;
// (undocumented)
sortOrder?: estypes.SortOrder;
sortOrder?: estypes.SearchSortOrder;
// (undocumented)
type: string | string[];
typeToNamespacesMap?: Map<string, string[] | undefined>;

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { get, isPlainObject } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { IIndexPattern, IFieldType } from '../../index_patterns';
@ -23,7 +23,7 @@ export type PhraseFilter = Filter & {
script?: {
script: {
source?: any;
lang?: string;
lang?: estypes.ScriptLanguage;
params: any;
};
};

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { map, reduce, mapValues, get, keys, pickBy } from 'lodash';
import { Filter, FilterMeta } from './meta_filter';
import { IIndexPattern, IFieldType } from '../../index_patterns';
@ -63,7 +63,7 @@ export type RangeFilter = Filter &
script?: {
script: {
params: any;
lang: string;
lang: estypes.ScriptLanguage;
source: any;
};
};

View file

@ -16,7 +16,7 @@ Object {
"esTypes": Array [
"keyword",
],
"lang": "lang",
"lang": "java",
"name": "name",
"readFromDocValues": false,
"script": "script",
@ -58,7 +58,7 @@ Object {
},
},
"isMapped": undefined,
"lang": "lang",
"lang": "java",
"name": "name",
"readFromDocValues": false,
"runtimeField": Object {

View file

@ -24,7 +24,7 @@ describe('Field', function () {
name: 'name',
type: 'string',
script: 'script',
lang: 'lang',
lang: 'java' as const,
count: 1,
esTypes: ['text'], // note, this will get replaced by the runtime field type
aggregatable: true,

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { FieldSpec, IFieldSubType, IndexPattern } from '../..';
/**
@ -16,7 +16,7 @@ export interface IFieldType {
name: string;
type: string;
script?: string;
lang?: string;
lang?: estypes.ScriptLanguage;
count?: number;
// esTypes might be undefined on old index patterns that have not been refreshed since we added
// this prop. It is also undefined on scripted fields.

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { ToastInputFields, ErrorToastOptions } from 'src/core/public/notifications';
// eslint-disable-next-line
import type { SavedObject } from 'src/core/server';
@ -178,7 +178,7 @@ export type FieldSpecConflictDescriptions = Record<string, string[]>;
export interface FieldSpecExportFmt {
count?: number;
script?: string;
lang?: string;
lang?: estypes.ScriptLanguage;
conflictDescriptions?: FieldSpecConflictDescriptions;
name: string;
type: KBN_FIELD_TYPES;
@ -208,7 +208,7 @@ export interface FieldSpec {
* Scripted field langauge
* Painless is the only valid scripted field language
*/
lang?: string;
lang?: estypes.ScriptLanguage;
conflictDescriptions?: Record<string, string[]>;
format?: SerializedFieldFormat;
name: string;

View file

@ -10,7 +10,7 @@ import moment from 'moment';
import _, { cloneDeep } from 'lodash';
import { i18n } from '@kbn/i18n';
import { Assign } from '@kbn/utility-types';
import { Aggregate, Bucket } from '@elastic/elasticsearch/api/types';
import type { estypes } from '@elastic/elasticsearch';
import {
IEsSearchResponse,
@ -57,7 +57,9 @@ export interface AggConfigsOptions {
export type CreateAggConfigParams = Assign<AggConfigSerialized, { type: string | IAggType }>;
export type GenericBucket = Bucket & { [property: string]: Aggregate };
export type GenericBucket = estypes.AggregationsBucket & {
[property: string]: estypes.AggregationsAggregate;
};
/**
* @name AggConfigs
@ -412,7 +414,7 @@ export class AggConfigs {
const transformedRawResponse = cloneDeep(response.rawResponse);
if (!transformedRawResponse.aggregations) {
transformedRawResponse.aggregations = {
doc_count: response.rawResponse.hits?.total as Aggregate,
doc_count: response.rawResponse.hits?.total as estypes.AggregationsAggregate,
};
}
const aggCursor = transformedRawResponse.aggregations!;

View file

@ -8,12 +8,7 @@
import moment from 'moment';
import _, { isArray } from 'lodash';
import {
Aggregate,
FiltersAggregate,
FiltersBucketItem,
MultiBucketAggregate,
} from '@elastic/elasticsearch/api/types';
import type { estypes } from '@elastic/elasticsearch';
import { AggGroupNames } from '../agg_groups';
import { GenericBucket, AggConfigs, getTime, AggConfig } from '../../../../common';
@ -156,12 +151,15 @@ import { IBucketAggConfig } from '../buckets';
}
// ...
* ```
*
*
*
*
* @param aggConfigs The agg configs instance
* @param aggCursor The root aggregations object from the response which will be mutated in place
*/
export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string, Aggregate>) {
export function mergeTimeShifts(
aggConfigs: AggConfigs,
aggCursor: Record<string, estypes.AggregationsAggregate>
) {
const timeShifts = aggConfigs.getTimeShifts();
const hasMultipleTimeShifts = Object.keys(timeShifts).length > 1;
const requestAggs = aggConfigs.getRequestAggs();
@ -200,7 +198,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
} else if (agg && agg === bucketAggs[aggIndex]) {
const bucketAgg = agg as IBucketAggConfig;
// expected next bucket sub agg
const subAggregate = val as Aggregate;
const subAggregate = val as estypes.AggregationsAggregate;
const buckets = ('buckets' in subAggregate ? subAggregate.buckets : undefined) as
| GenericBucket[]
| Record<string, GenericBucket>
@ -212,7 +210,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
buckets: isArray(buckets) ? [] : {},
};
}
const baseSubAggregate = target[key] as Aggregate;
const baseSubAggregate = target[key] as estypes.AggregationsAggregate;
// only supported bucket formats in agg configs are array of buckets and record of buckets for filters
const baseBuckets = ('buckets' in baseSubAggregate
? baseSubAggregate.buckets
@ -233,7 +231,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
}
mergeAggLevel(baseBucketMap[bucketKey], bucket, shift, aggIndex + 1);
});
(baseSubAggregate as MultiBucketAggregate).buckets = Object.values(
(baseSubAggregate as estypes.AggregationsMultiBucketAggregate).buckets = Object.values(
baseBucketMap
).sort((a, b) => bucketAgg.type.orderBuckets(bucketAgg, a, b));
} else if (baseBuckets && buckets && !isArray(baseBuckets)) {
@ -249,7 +247,10 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
}
});
};
const transformTimeShift = (cursor: Record<string, Aggregate>, aggIndex: number): undefined => {
const transformTimeShift = (
cursor: Record<string, estypes.AggregationsAggregate>,
aggIndex: number
): undefined => {
const shouldSplit = aggConfigs.aggs[aggIndex].type.splitForTimeShift(
aggConfigs.aggs[aggIndex],
aggConfigs
@ -257,10 +258,8 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
if (shouldSplit) {
// multiple time shifts caused a filters agg in the tree we have to merge
if (hasMultipleTimeShifts && cursor.time_offset_split) {
const timeShiftedBuckets = (cursor.time_offset_split as FiltersAggregate).buckets as Record<
string,
FiltersBucketItem
>;
const timeShiftedBuckets = (cursor.time_offset_split as estypes.AggregationsFiltersAggregate)
.buckets as Record<string, estypes.AggregationsFiltersBucketItem>;
const subTree = {};
Object.entries(timeShifts).forEach(([key, shift]) => {
mergeAggLevel(
@ -301,7 +300,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
/**
* Inserts a filters aggregation into the aggregation tree which splits buckets to fetch data for all time ranges
* configured in metric aggregations.
*
*
* The current agg config can implement `splitForTimeShift` to force insertion of the time split filters aggregation
* before the dsl of the agg config (date histogram and metrics aggregations do this)
*
@ -324,7 +323,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
"date_histogram": {
"field": "timestamp",
"interval": "year"
},
},
"aggs": {
"revenue": {
"sum": {
@ -347,7 +346,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
"aggs": {
"first_year": {
"filter": {
"range": {
"range": {
"timestamp": {
"gte": "2019",
"lte": "2020"
@ -366,7 +365,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
"filters": {
"filters": {
"regular": {
"range": {
"range": {
"timestamp": {
"gte": "2019",
"lte": "2020"
@ -388,7 +387,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
"date_histogram": {
"field": "timestamp",
"interval": "year"
},
},
"aggs": {
"revenue": {
"sum": {
@ -399,7 +398,7 @@ export function mergeTimeShifts(aggConfigs: AggConfigs, aggCursor: Record<string
}
}
}
}
}
* ```
*/
export function insertTimeShiftSplit(

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { NameList } from 'elasticsearch';
import { IAggConfigs } from 'src/plugins/data/public';
import { Query } from '../..';
@ -156,7 +156,7 @@ export interface ShardFailure {
type: string;
};
reason: string;
lang?: string;
lang?: estypes.ScriptLanguage;
script?: string;
script_stack?: string[];
type: string;

View file

@ -41,6 +41,7 @@ describe('Kuery field suggestions', () => {
querySuggestionsArgs,
mockKueryNode({ prefix, suffix })
);
// @ts-expect-error indexPatternResponse is not properly typed json
const filterableFields = indexPatternResponse.fields.filter(indexPatternsUtils.isFilterable);
expect(suggestions.length).toBe(filterableFields.length);

View file

@ -7,13 +7,11 @@
import { $Values } from '@kbn/utility-types';
import { Action } from 'history';
import { Adapters as Adapters_2 } from 'src/plugins/inspector/common';
import { Aggregate } from '@elastic/elasticsearch/api/types';
import { ApiResponse } from '@elastic/elasticsearch/lib/Transport';
import { ApplicationStart } from 'kibana/public';
import { Assign } from '@kbn/utility-types';
import { BfetchPublicSetup } from 'src/plugins/bfetch/public';
import Boom from '@hapi/boom';
import { Bucket } from '@elastic/elasticsearch/api/types';
import { ConfigDeprecationProvider } from '@kbn/config';
import { CoreSetup } from 'src/core/public';
import { CoreSetup as CoreSetup_2 } from 'kibana/public';
@ -1245,7 +1243,7 @@ export interface IFieldType {
// (undocumented)
format?: any;
// (undocumented)
lang?: string;
lang?: estypes.ScriptLanguage;
// (undocumented)
name: string;
// (undocumented)
@ -1378,16 +1376,12 @@ export class IndexPattern implements IIndexPattern {
};
// (undocumented)
getAggregationRestrictions(): Record<string, Record<string, {
agg?: string | undefined; /**
* Get last saved saved object fields
*/
agg?: string | undefined;
interval?: number | undefined;
fixed_interval?: string | undefined;
calendar_interval?: string | undefined;
delay?: string | undefined;
time_zone?: string | undefined; /**
* Reset last saved saved object fields. used after saving
*/
time_zone?: string | undefined;
}>> | undefined;
getAsSavedObjectBody(): IndexPatternAttributes;
// (undocumented)
@ -1530,8 +1524,8 @@ export class IndexPatternField implements IFieldType {
// (undocumented)
get filterable(): boolean;
get isMapped(): boolean | undefined;
get lang(): string | undefined;
set lang(lang: string | undefined);
get lang(): "painless" | "expression" | "mustache" | "java" | undefined;
set lang(lang: "painless" | "expression" | "mustache" | "java" | undefined);
// (undocumented)
get name(): string;
// (undocumented)
@ -1555,7 +1549,7 @@ export class IndexPatternField implements IFieldType {
toJSON(): {
count: number;
script: string | undefined;
lang: string | undefined;
lang: "painless" | "expression" | "mustache" | "java" | undefined;
conflictDescriptions: Record<string, string[]> | undefined;
name: string;
type: string;
@ -2002,7 +1996,7 @@ export type PhraseFilter = Filter & {
script?: {
script: {
source?: any;
lang?: string;
lang?: estypes.ScriptLanguage;
params: any;
};
};
@ -2220,7 +2214,7 @@ export type RangeFilter = Filter & EsRangeFilter & {
script?: {
script: {
params: any;
lang: string;
lang: estypes.ScriptLanguage;
source: any;
};
};
@ -2266,7 +2260,7 @@ export interface Reason {
reason: string;
};
// (undocumented)
lang?: string;
lang?: estypes.ScriptLanguage;
// (undocumented)
position?: {
offset: number;

View file

@ -23,6 +23,7 @@ describe('PainlessError', () => {
const e = new PainlessError({
statusCode: 400,
message: 'search_phase_execution_exception',
// @ts-expect-error searchPhaseException is not properly typed json
attributes: searchPhaseException.error,
});
const component = mount(e.getErrorMessage(startMock.application));

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
import { KibanaServerError } from '../../../../kibana_utils/common';
export interface FailedShard {
@ -24,7 +24,7 @@ export interface Reason {
start: number;
end: number;
};
lang?: string;
lang?: estypes.ScriptLanguage;
script?: string;
caused_by?: {
type: string;

View file

@ -135,6 +135,7 @@ describe('SearchInterceptor', () => {
new PainlessError({
statusCode: 400,
message: 'search_phase_execution_exception',
// @ts-expect-error searchPhaseException is not properly typed json
attributes: searchPhaseException.error,
})
);

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { estypes } from '@elastic/elasticsearch';
export interface ShardFailureRequest {
docvalue_fields: string[];
_source: unknown;
@ -24,7 +24,7 @@ export interface ShardFailure {
type: string;
};
reason: string;
lang?: string;
lang?: estypes.ScriptLanguage;
script?: string;
script_stack?: string[];
type: string;

View file

@ -78,7 +78,7 @@ async function getBody(
{ timeout, terminate_after }: Record<string, any>,
field: IFieldType | string,
query: string,
filters: estypes.QueryContainer[] = []
filters: estypes.QueryDslQueryContainer[] = []
) {
const isFieldObject = (f: any): f is IFieldType => Boolean(f && f.name);

View file

@ -69,7 +69,7 @@ import { FieldDescriptor } from '../../../fetcher';
* @return {Array<FieldDescriptor>}
*/
export function readFieldCapsResponse(
fieldCapsResponse: estypes.FieldCapabilitiesResponse
fieldCapsResponse: estypes.FieldCapsResponse
): FieldDescriptor[] {
const capsByNameThenType = fieldCapsResponse.fields;

View file

@ -8,7 +8,8 @@
import { Observable } from 'rxjs';
import { first } from 'rxjs/operators';
import { IUiSettingsClient, IScopedClusterClient, SharedGlobalConfig } from 'src/core/server';
import type { IUiSettingsClient, IScopedClusterClient, SharedGlobalConfig } from 'src/core/server';
import type { estypes } from '@elastic/elasticsearch';
import type { MsearchRequestBody, MsearchResponse } from '../../../common/search/search_source';
import { getKbnServerError } from '../../../../kibana_utils/server';
@ -78,7 +79,9 @@ export function getCallMsearch(dependencies: CallMsearchDependencies) {
body: {
...response,
body: {
responses: response.body.responses?.map((r) => shimHitsTotal(r)),
responses: response.body.responses?.map((r) =>
shimHitsTotal(r as estypes.SearchResponse<unknown>)
),
},
},
};

View file

@ -116,7 +116,7 @@ describe('msearch route', () => {
const error: any = mockResponse.customError.mock.calls[0][0];
expect(error.statusCode).toBe(400);
expect(error.body.message).toBe('json_e_o_f_exception');
expect(error.body.message).toMatch(/json_e_o_f_exception/);
expect(error.body.attributes).toBe(jsonEofException.error);
});

Some files were not shown because too many files have changed in this diff Show more