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>
This commit is contained in:
Mikhail Shustov 2021-06-08 15:06:06 +02:00 committed by GitHub
parent fc8ca1da63
commit d920682e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
368 changed files with 835 additions and 1049 deletions

View file

@ -8,9 +8,9 @@
import { estypes } from '@elastic/elasticsearch';
import { InferSearchResponseOf, AggregateOf as AggregationResultOf, SearchHit } from './search';
export type ESFilter = estypes.QueryContainer;
export type ESFilter = estypes.QueryDslQueryContainer;
export type ESSearchRequest = estypes.SearchRequest;
export type AggregationOptionsByType = Required<estypes.AggregationContainer>;
export type AggregationOptionsByType = Required<estypes.AggregationsAggregationContainer>;
// Typings for Elasticsearch queries and aggregations. These are intended to be
// moved to the Elasticsearch JS client at some point (see #77720.)

View file

@ -28,14 +28,14 @@ type KeysOfSources<T extends any[]> = T extends [infer U, ...infer V]
: {};
type CompositeKeysOf<
TAggregationContainer extends estypes.AggregationContainer
TAggregationContainer extends estypes.AggregationsAggregationContainer
> = TAggregationContainer extends {
composite: { sources: [...infer TSource] };
}
? KeysOfSources<TSource>
: unknown;
type Source = estypes.SourceFilter | boolean | estypes.Fields;
type Source = estypes.SearchSourceFilter | boolean | estypes.Fields;
type ValueTypeOfField<T> = T extends Record<string, string | number>
? ValuesType<T>
@ -50,13 +50,13 @@ type ValueTypeOfField<T> = T extends Record<string, string | number>
type MaybeArray<T> = T | T[];
type Fields = Exclude<Required<estypes.SearchRequest>['body']['fields'], undefined>;
type DocValueFields = MaybeArray<string | estypes.DocValueField>;
type DocValueFields = MaybeArray<string | estypes.SearchDocValueField>;
export type SearchHit<
TSource extends any = unknown,
TFields extends Fields | undefined = undefined,
TDocValueFields extends DocValueFields | undefined = undefined
> = Omit<estypes.Hit, '_source' | 'fields'> &
> = Omit<estypes.SearchHit, '_source' | 'fields'> &
(TSource extends false ? {} : { _source: TSource }) &
(TFields extends Fields
? {
@ -82,11 +82,17 @@ type HitsOf<
>
>;
type AggregationTypeName = Exclude<keyof estypes.AggregationContainer, 'aggs' | 'aggregations'>;
type AggregationTypeName = Exclude<
keyof estypes.AggregationsAggregationContainer,
'aggs' | 'aggregations'
>;
type AggregationMap = Partial<Record<string, estypes.AggregationContainer>>;
type AggregationMap = Partial<Record<string, estypes.AggregationsAggregationContainer>>;
type TopLevelAggregationRequest = Pick<estypes.AggregationContainer, 'aggs' | 'aggregations'>;
type TopLevelAggregationRequest = Pick<
estypes.AggregationsAggregationContainer,
'aggs' | 'aggregations'
>;
type MaybeKeyed<
TAggregationContainer,
@ -97,7 +103,7 @@ type MaybeKeyed<
: { buckets: TBucket[] };
export type AggregateOf<
TAggregationContainer extends estypes.AggregationContainer,
TAggregationContainer extends estypes.AggregationsAggregationContainer,
TDocument
> = (Record<AggregationTypeName, unknown> & {
adjacency_matrix: {
@ -518,9 +524,9 @@ export type AggregateOf<
relation: 'eq' | 'gte';
};
max_score: number | null;
hits: TAggregationContainer extends { top_hits: estypes.TopHitsAggregation }
hits: TAggregationContainer extends { top_hits: estypes.AggregationsTopHitsAggregation }
? HitsOf<TAggregationContainer['top_hits'], TDocument>
: estypes.HitsMetadata<TDocument>;
: estypes.SearchHitsMetadata<TDocument>;
};
};
top_metrics: {
@ -542,7 +548,7 @@ export type AggregateOf<
})[ValidAggregationKeysOf<TAggregationContainer> & AggregationTypeName];
type AggregateOfMap<TAggregationMap extends AggregationMap, TDocument> = {
[TAggregationName in keyof TAggregationMap]: TAggregationMap[TAggregationName] extends estypes.AggregationContainer
[TAggregationName in keyof TAggregationMap]: TAggregationMap[TAggregationName] extends estypes.AggregationsAggregationContainer
? AggregateOf<TAggregationMap[TAggregationName], TDocument>
: never; // using never means we effectively ignore optional keys, using {} creates a union type of { ... } | {}
};