From dfddfecfb21e1b808149892d4143efa18b5a7f61 Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Thu, 14 Oct 2021 15:15:51 +0200 Subject: [PATCH] Fixes in custom Kibana type def (#1559) --- index.d.ts | 4 +- package.json | 2 +- src/Helpers.ts | 1 + src/api/types.ts | 260 ++++++++++++++++++++++-------------- src/api/typesWithBodyKey.ts | 260 ++++++++++++++++++++++-------------- 5 files changed, 330 insertions(+), 197 deletions(-) diff --git a/index.d.ts b/index.d.ts index a96aa2b92..9faaea9b1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -17,7 +17,7 @@ * under the License. */ -import { errors } from '@elastic/transport' import Client from './lib/Client' -export { Client, errors } +export * from '@elastic/transport' +export { Client } diff --git a/package.json b/package.json index 94b29c66e..13b617da9 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "xmlbuilder2": "^3.0.2" }, "dependencies": { - "@elastic/transport": "^0.0.6", + "@elastic/transport": "^0.0.7", "tslib": "^2.3.0" }, "tap": { diff --git a/src/Helpers.ts b/src/Helpers.ts index cc36b9841..ecb4f75b7 100644 --- a/src/Helpers.ts +++ b/src/Helpers.ts @@ -841,6 +841,7 @@ export default class Helpers { } else { onDrop({ status: responseItem.status, + // @ts-expect-error error: responseItem.error ?? null, operation: serializer.deserialize(bulkBody[indexSlice]), document: operation !== 'delete' diff --git a/src/api/types.ts b/src/api/types.ts index 12ea36bd0..a9eeea661 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -88,7 +88,7 @@ export interface BulkResponseItemBase { _id?: string | null _index: string status: integer - error?: ErrorCause + error?: ErrorCause | string _primary_term?: long result?: string _seq_no?: SequenceNumber @@ -473,7 +473,7 @@ export interface InfoResponse { } export interface MgetHit { - error?: MainError + error?: ErrorCause | string fields?: Record found?: boolean _id: Id @@ -630,7 +630,7 @@ export interface MtermvectorsTermVectorsResult { took?: long found?: boolean term_vectors?: Record - error?: ErrorCause + error?: ErrorCause | string } export interface OpenPointInTimeRequest extends RequestBase { @@ -870,12 +870,6 @@ export interface ScriptsPainlessExecutePainlessContextSetup { query: QueryDslQueryContainer } -export interface ScriptsPainlessExecutePainlessExecutionPosition { - offset: integer - start: integer - end: integer -} - export interface ScriptsPainlessExecuteRequest extends RequestBase { context?: string context_setup?: ScriptsPainlessExecutePainlessContextSetup @@ -998,11 +992,46 @@ export interface SearchAggregationProfile { time_in_nanos: long type: string debug?: SearchAggregationProfileDebug - children?: SearchAggregationProfileDebug[] + children?: SearchAggregationProfile[] } export interface SearchAggregationProfileDebug { - [key: string]: never + segments_with_multi_valued_ords?: integer + collection_strategy?: string + segments_with_single_valued_ords?: integer + total_buckets?: integer + built_buckets?: integer + result_strategy?: string + has_filter?: boolean + delegate?: string + delegate_debug?: SearchAggregationProfileDelegateDebug + chars_fetched?: integer + extract_count?: integer + extract_ns?: integer + values_fetched?: integer + collect_analyzed_ns?: integer + collect_analyzed_count?: integer + surviving_buckets?: integer + ordinals_collectors_used?: integer + ordinals_collectors_overhead_too_high?: integer + string_hashing_collectors_used?: integer + numeric_collectors_used?: integer + empty_collectors_used?: integer + deferred_aggregators?: string[] +} + +export interface SearchAggregationProfileDelegateDebug { + segments_with_doc_count_field?: integer + segments_with_deleted_docs?: integer + filters?: SearchAggregationProfileDelegateDebugFilter[] + segments_counted?: integer + segments_collected?: integer +} + +export interface SearchAggregationProfileDelegateDebugFilter { + results_from_metadata?: integer + query?: string + specialized_for?: string } export type SearchBoundaryScanner = 'chars' | 'sentence' | 'word' @@ -1056,6 +1085,29 @@ export interface SearchDocValueField { format?: string } +export interface SearchFetchProfile { + type: string + description: string + time_in_nanos: long + breakdown: SearchFetchProfileBreakdown + debug?: SearchFetchProfileDebug + children?: SearchFetchProfile[] +} + +export interface SearchFetchProfileBreakdown { + load_stored_fields?: integer + load_stored_fields_count?: integer + next_reader?: integer + next_reader_count?: integer + process_count?: integer + process?: integer +} + +export interface SearchFetchProfileDebug { + stored_fields?: string[] + fast_path?: integer +} + export interface SearchFieldAndFormat { field: Field format?: string @@ -1332,6 +1384,7 @@ export interface SearchShardProfile { aggregations: SearchAggregationProfile[] id: string searches: SearchSearchProfile[] + fetch?: SearchFetchProfile } export interface SearchSmoothingModelContainer { @@ -1464,7 +1517,7 @@ export type SearchMvtResponse = MapboxVectorTiles export type SearchMvtCoordinate = integer -export type SearchMvtGridType = 'grid' | 'point' +export type SearchMvtGridType = 'grid' | 'point' | 'centroid' export type SearchMvtZoomLevel = integer @@ -1713,7 +1766,7 @@ export interface AcknowledgedResponseBase { export type AggregateName = string export interface BulkIndexByScrollFailure { - cause: MainError + cause: ErrorCause | string id: Id index: IndexName status: integer @@ -1807,42 +1860,20 @@ export interface EmptyObject { export type EpochMillis = string | long -export interface ErrorCause { - type: string +export interface ErrorCauseKeys { + type?: string reason: string - caused_by?: ErrorCause - shard?: integer | string stack_trace?: string - root_cause?: ErrorCause[] - bytes_limit?: long - bytes_wanted?: long - column?: integer - col?: integer - failed_shards?: ShardFailure[] - grouped?: boolean - index?: IndexName - index_uuid?: Uuid - language?: string - licensed_expired_feature?: string - line?: integer - max_buckets?: integer - phase?: string - property_name?: string - processor_type?: string - resource_id?: Ids - 'resource.id'?: Ids - resource_type?: string - 'resource.type'?: string - script?: string - script_stack?: string[] - header?: HttpHeaders - lang?: string - position?: ScriptsPainlessExecutePainlessExecutionPosition + caused_by?: ErrorCause | string + root_cause: (ErrorCause | string)[] + suppressed?: (ErrorCause | string)[] } +export type ErrorCause = ErrorCauseKeys | +{ [property: string]: any } export interface ErrorResponseBase { - error: MainError | string - status?: integer + error: ErrorCause | string + status: integer } export type ExpandWildcardOptions = 'all' | 'open' | 'closed' | 'hidden' | 'none' @@ -1973,10 +2004,6 @@ export type Level = 'cluster' | 'indices' | 'shards' export type LifecycleOperationMode = 'RUNNING' | 'STOPPING' | 'STOPPED' -export interface MainError extends ErrorCause { - headers?: Record -} - export type MapboxVectorTiles = ArrayBuffer export interface MergesStats { @@ -2043,7 +2070,7 @@ export interface NodeShard { } export interface NodeStatistics { - failures?: ErrorCause[] + failures?: (ErrorCause | string)[] total: integer successful: integer failed: integer @@ -2206,7 +2233,7 @@ export type ShapeRelation = 'intersects' | 'disjoint' | 'within' export interface ShardFailure { index?: IndexName node?: string - reason: ErrorCause + reason: ErrorCause | string shard: integer status?: string } @@ -2500,10 +2527,6 @@ export interface AggregationsBucketSortAggregation extends AggregationsAggregati sort?: SearchSort } -export interface AggregationsBucketsPath { - [key: string]: never -} - export interface AggregationsCardinalityAggregation extends AggregationsMetricAggregationBase { precision_threshold?: integer rehash?: boolean @@ -2741,7 +2764,7 @@ export interface AggregationsGlobalAggregation extends AggregationsBucketAggrega } export interface AggregationsGoogleNormalizedDistanceHeuristic { - background_is_superset: boolean + background_is_superset?: boolean } export interface AggregationsHdrMethod { @@ -2889,6 +2912,8 @@ export interface AggregationsMissingAggregation extends AggregationsBucketAggreg missing?: AggregationsMissing } +export type AggregationsMissingOrder = 'first' | 'last' | 'default' + export interface AggregationsMovingAverageAggregation extends AggregationsPipelineAggregationBase { minimize?: boolean model?: AggregationsMovingAverageModel @@ -2926,8 +2951,8 @@ export interface AggregationsMultiTermsAggregation extends AggregationsBucketAgg } export interface AggregationsMutualInformationHeuristic { - background_is_superset: boolean - include_negatives: boolean + background_is_superset?: boolean + include_negatives?: boolean } export interface AggregationsNestedAggregation extends AggregationsBucketAggregationBase { @@ -2976,13 +3001,14 @@ export interface AggregationsPercentilesBucketAggregation extends AggregationsPi } export interface AggregationsPipelineAggregationBase extends AggregationsAggregation { - buckets_path?: AggregationsBucketsPath + buckets_path?: string | string[] | Record format?: string gap_policy?: AggregationsGapPolicy } export interface AggregationsRangeAggregation extends AggregationsBucketAggregationBase { field?: Field + missing?: integer ranges?: AggregationsAggregationRange[] script?: Script keyed?: boolean @@ -3173,6 +3199,7 @@ export interface AggregationsTermsAggregation extends AggregationsBucketAggregat include?: string | string[] | AggregationsTermsInclude min_doc_count?: integer missing?: AggregationsMissing + missing_order?: AggregationsMissingOrder missing_bucket?: boolean value_type?: string order?: AggregationsTermsAggregationOrder @@ -3437,7 +3464,7 @@ export interface AnalysisKeywordTokenizer extends AnalysisTokenizerBase { export interface AnalysisKuromojiAnalyzer { type: 'kuromoji' mode: AnalysisKuromojiTokenizationMode - user_dictionary: string + user_dictionary?: string } export interface AnalysisKuromojiPartOfSpeechTokenFilter extends AnalysisTokenFilterBase { @@ -3494,6 +3521,10 @@ export interface AnalysisLimitTokenCountTokenFilter extends AnalysisTokenFilterB max_token_count: integer } +export interface AnalysisLowercaseNormalizer { + type: 'lowercase' +} + export interface AnalysisLowercaseTokenFilter extends AnalysisTokenFilterBase { type: 'lowercase' language: string @@ -3506,7 +3537,7 @@ export interface AnalysisLowercaseTokenizer extends AnalysisTokenizerBase { export interface AnalysisMappingCharFilter extends AnalysisCharFilterBase { type: 'mapping' mappings: string[] - mappings_path: string + mappings_path?: string } export interface AnalysisMultiplexerTokenFilter extends AnalysisTokenFilterBase { @@ -3552,6 +3583,8 @@ export interface AnalysisNoriTokenizer extends AnalysisTokenizerBase { user_dictionary_rules: string[] } +export type AnalysisNormalizer = AnalysisLowercaseNormalizer | AnalysisCustomNormalizer + export interface AnalysisPathHierarchyTokenizer extends AnalysisTokenizerBase { type: 'path_hierarchy' buffer_size: integer @@ -3676,13 +3709,13 @@ export interface AnalysisSynonymGraphTokenFilter extends AnalysisTokenFilterBase export interface AnalysisSynonymTokenFilter extends AnalysisTokenFilterBase { type: 'synonym' - expand: boolean - format: AnalysisSynonymFormat - lenient: boolean + expand?: boolean + format?: AnalysisSynonymFormat + lenient?: boolean synonyms: string[] - synonyms_path: string - tokenizer: string - updateable: boolean + synonyms_path?: string + tokenizer?: string + updateable?: boolean } export type AnalysisTokenChar = 'letter' | 'digit' | 'whitespace' | 'punctuation' | 'symbol' | 'custom' @@ -3880,7 +3913,8 @@ export interface MappingFieldAliasProperty extends MappingPropertyBase { } export interface MappingFieldMapping { - [key: string]: never + full_name: string + mapping: Record } export interface MappingFieldNamesField { @@ -3921,7 +3955,7 @@ export interface MappingGenericProperty extends MappingDocValuesPropertyBase { type: string } -export type MappingGeoOrientation = 'right' | 'RIGHT' | 'counterclockwise' | 'COUNTERCLOCKWISE' | 'ccw' | 'CCW' | 'left' | 'LEFT' | 'clockwise' | 'CLOCKWISE' | 'cw' | 'CW' +export type MappingGeoOrientation = 'right' | 'left' export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean @@ -3960,6 +3994,7 @@ export interface MappingIpProperty extends MappingDocValuesPropertyBase { boost?: double index?: boolean null_value?: string + ignore_malformed?: boolean type: 'ip' } @@ -4085,13 +4120,11 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase type: 'search_as_you_type' } -export type MappingShapeOrientation = 'right' | 'counterclockwise' | 'ccw' | 'left' | 'clockwise' | 'cw' - export interface MappingShapeProperty extends MappingDocValuesPropertyBase { coerce?: boolean ignore_malformed?: boolean ignore_z_value?: boolean - orientation?: MappingShapeOrientation + orientation?: MappingGeoOrientation type: 'shape' } @@ -4163,6 +4196,7 @@ export interface MappingTypeMapping { _size?: MappingSizeField _source?: MappingSourceField runtime?: Record + enabled?: boolean } export interface MappingVersionProperty extends MappingDocValuesPropertyBase { @@ -4241,6 +4275,8 @@ export interface QueryDslDateRangeQuery extends QueryDslRangeQueryBase { gte?: DateMath lt?: DateMath lte?: DateMath + from?: DateMath + to?: DateMath format?: DateFormat time_zone?: TimeZone } @@ -4321,7 +4357,7 @@ export interface QueryDslFuzzyQuery extends QueryDslQueryBase { rewrite?: MultiTermQueryRewrite transpositions?: boolean fuzziness?: Fuzziness - value: string + value: string | double | boolean } export interface QueryDslGeoBoundingBoxQueryKeys extends QueryDslQueryBase { @@ -4595,6 +4631,8 @@ export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { gte?: double lt?: double lte?: double + from?: double + to?: double } export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase { @@ -4622,9 +4660,15 @@ export interface QueryDslPercolateQuery extends QueryDslQueryBase { version?: VersionNumber } +export interface QueryDslPinnedDoc { + _id: Id + _index: IndexName +} + export interface QueryDslPinnedQuery extends QueryDslQueryBase { - ids: Id[] organic: QueryDslQueryContainer + ids?: Id[] + docs?: QueryDslPinnedDoc[] } export interface QueryDslPrefixQuery extends QueryDslQueryBase { @@ -4648,7 +4692,7 @@ export interface QueryDslQueryContainer { distance_feature?: QueryDslDistanceFeatureQuery exists?: QueryDslExistsQuery function_score?: QueryDslFunctionScoreQuery - fuzzy?: Record + fuzzy?: Record geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery geo_polygon?: QueryDslGeoPolygonQuery @@ -6853,7 +6897,7 @@ export interface CcrFollowIndexStats { } export interface CcrReadException { - exception: ErrorCause + exception: ErrorCause | string from_seq_no: SequenceNumber retries: integer } @@ -6862,7 +6906,7 @@ export interface CcrShardStats { bytes_read: long failed_read_requests: long failed_write_requests: long - fatal_exception?: ErrorCause + fatal_exception?: ErrorCause | string follower_aliases_version: VersionNumber follower_global_checkpoint: long follower_index: string @@ -7058,7 +7102,7 @@ export interface CcrStatsAutoFollowStats { number_of_failed_follow_indices: long number_of_failed_remote_cluster_state_requests: long number_of_successful_follow_indices: long - recent_auto_follow_errors: ErrorCause[] + recent_auto_follow_errors: (ErrorCause | string)[] } export interface CcrStatsAutoFollowedCluster { @@ -8014,8 +8058,9 @@ export interface IlmAction { } export interface IlmPhase { - actions: Record | string[] + actions?: Record | string[] min_age?: Time + configurations?: Record> } export interface IlmPhases { @@ -8170,6 +8215,10 @@ export interface IndicesAliasDefinition { search_routing?: string } +export interface IndicesDataStream { + hidden?: boolean +} + export type IndicesDataStreamHealthStatus = 'green' | 'yellow' | 'red' export interface IndicesFielddataFrequencyFilter { @@ -8215,15 +8264,10 @@ export type IndicesIndexRoutingRebalanceOptions = 'all' | 'primaries' | 'replica export interface IndicesIndexSettingBlocks { read_only?: boolean - 'index.blocks.read_only'?: boolean read_only_allow_delete?: boolean - 'index.blocks.read_only_allow_delete'?: boolean read?: boolean - 'index.blocks.read'?: boolean write?: boolean | string - 'index.blocks.write'?: boolean | string metadata?: boolean - 'index.blocks.metadata'?: boolean } export interface IndicesIndexSettings { @@ -8267,6 +8311,16 @@ export interface IndicesIndexSettings { 'index.max_shingle_diff'?: integer blocks?: IndicesIndexSettingBlocks 'index.blocks'?: IndicesIndexSettingBlocks + 'blocks.read_only'?: boolean + 'index.blocks.read_only'?: boolean + 'blocks.read_only_allow_delete'?: boolean + 'index.blocks.read_only_allow_delete'?: boolean + 'blocks.read'?: boolean + 'index.blocks.read'?: boolean + 'blocks.write'?: boolean | string + 'index.blocks.write'?: boolean | string + 'blocks.metadata'?: boolean + 'index.blocks.metadata'?: boolean max_refresh_listeners?: integer 'index.max_refresh_listeners'?: integer 'analyze.max_token_count'?: integer @@ -8287,6 +8341,8 @@ export interface IndicesIndexSettings { 'index.final_pipeline'?: PipelineName lifecycle?: IndicesIndexSettingsLifecycle 'index.lifecycle'?: IndicesIndexSettingsLifecycle + 'lifecycle.name'?: string + 'index.lifecycle.name'?: string provided_name?: Name 'index.provided_name'?: Name creation_date?: DateString @@ -8309,13 +8365,14 @@ export interface IndicesIndexSettings { 'index.priority'?: integer | string top_metrics_max_size?: integer analysis?: IndicesIndexSettingsAnalysis + settings?: IndicesIndexSettings } export interface IndicesIndexSettingsAnalysis { analyzer?: Record char_filter?: Record filter?: Record - normalizer?: Record + normalizer?: Record } export interface IndicesIndexSettingsLifecycle { @@ -8513,9 +8570,10 @@ export interface IndicesCreateRequest extends RequestBase { settings?: Record } -export interface IndicesCreateResponse extends AcknowledgedResponseBase { +export interface IndicesCreateResponse { index: IndexName shards_acknowledged: boolean + acknowledged?: boolean } export interface IndicesCreateDataStreamRequest extends RequestBase { @@ -8779,7 +8837,7 @@ export interface IndicesGetFieldMappingTypeFieldMappings { export interface IndicesGetIndexTemplateIndexTemplate { index_patterns: Name[] composed_of: Name[] - template: IndicesGetIndexTemplateIndexTemplateSummary + template?: IndicesGetIndexTemplateIndexTemplateSummary version?: VersionNumber priority?: long _meta?: Metadata @@ -8907,7 +8965,7 @@ export interface IndicesPutIndexTemplateRequest extends RequestBase { index_patterns?: Indices composed_of?: Name[] template?: IndicesPutIndexTemplateIndexTemplateMapping - data_stream?: EmptyObject + data_stream?: IndicesDataStream priority?: integer version?: VersionNumber _meta?: Metadata @@ -11957,7 +12015,7 @@ export interface MonitoringBulkRequest extends RequestBase { } export interface MonitoringBulkResponse { - error?: ErrorCause + error?: ErrorCause | string errors: boolean ignored: boolean took: long @@ -13385,7 +13443,7 @@ export interface SecurityInvalidateApiKeyRequest extends RequestBase { export interface SecurityInvalidateApiKeyResponse { error_count: integer - error_details?: ErrorCause[] + error_details?: (ErrorCause | string)[] invalidated_api_keys: string[] previously_invalidated_api_keys: string[] } @@ -13399,7 +13457,7 @@ export interface SecurityInvalidateTokenRequest extends RequestBase { export interface SecurityInvalidateTokenResponse { error_count: long - error_details?: ErrorCause[] + error_details?: (ErrorCause | string)[] invalidated_tokens: long previously_invalidated_tokens: long } @@ -13869,7 +13927,7 @@ export interface SnapshotGetResponse { export interface SnapshotGetSnapshotResponseItem { repository: Name snapshots?: SnapshotSnapshotInfo[] - error?: ErrorCause + error?: ErrorCause | string } export interface SnapshotGetRepositoryRequest extends RequestBase { @@ -14057,7 +14115,7 @@ export interface TasksCancelRequest extends RequestBase { } export interface TasksCancelResponse { - node_failures?: ErrorCause[] + node_failures?: (ErrorCause | string)[] nodes: Record } @@ -14071,7 +14129,7 @@ export interface TasksGetResponse { completed: boolean task: TasksInfo response?: TasksStatus - error?: ErrorCause + error?: ErrorCause | string } export interface TasksListRequest extends RequestBase { @@ -14085,7 +14143,7 @@ export interface TasksListRequest extends RequestBase { } export interface TasksListResponse { - node_failures?: ErrorCause[] + node_failures?: (ErrorCause | string)[] nodes?: Record tasks?: Record | TasksInfo[] } @@ -15000,7 +15058,7 @@ export interface XpackInfoFeatures { spatial: XpackInfoFeature sql: XpackInfoFeature transform: XpackInfoFeature - vectors: XpackInfoFeature + vectors?: XpackInfoFeature voting_only: XpackInfoFeature watcher: XpackInfoFeature } @@ -15029,6 +15087,14 @@ export interface XpackInfoResponse { tagline: string } +export interface XpackUsageAllJobs { + count: integer + detectors: Record + created_by: Record + model_size: Record + forecasts: Record +} + export interface XpackUsageAnalytics extends XpackUsageBase { stats: XpackUsageAnalyticsStatistics } @@ -15177,7 +15243,7 @@ export interface XpackUsageKibanaUrlConfig extends XpackUsageBaseUrlConfig { export interface XpackUsageMachineLearning extends XpackUsageBase { datafeeds: Record - jobs: Record + jobs: Record | Record node_count: integer data_frame_analytics_jobs: XpackUsageMlDataFrameAnalyticsJobs inference: XpackUsageMlInference @@ -15291,7 +15357,7 @@ export interface XpackUsageResponse { slm: XpackUsageSlm sql: XpackUsageSql transform: XpackUsageBase - vectors: XpackUsageVector + vectors?: XpackUsageVector voting_only: XpackUsageBase } diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 9dbb12f26..2671958fd 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -89,7 +89,7 @@ export interface BulkResponseItemBase { _id?: string | null _index: string status: integer - error?: ErrorCause + error?: ErrorCause | string _primary_term?: long result?: string _seq_no?: SequenceNumber @@ -496,7 +496,7 @@ export interface InfoResponse { } export interface MgetHit { - error?: MainError + error?: ErrorCause | string fields?: Record found?: boolean _id: Id @@ -662,7 +662,7 @@ export interface MtermvectorsTermVectorsResult { took?: long found?: boolean term_vectors?: Record - error?: ErrorCause + error?: ErrorCause | string } export interface OpenPointInTimeRequest extends RequestBase { @@ -914,12 +914,6 @@ export interface ScriptsPainlessExecutePainlessContextSetup { query: QueryDslQueryContainer } -export interface ScriptsPainlessExecutePainlessExecutionPosition { - offset: integer - start: integer - end: integer -} - export interface ScriptsPainlessExecuteRequest extends RequestBase { /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { @@ -1067,11 +1061,46 @@ export interface SearchAggregationProfile { time_in_nanos: long type: string debug?: SearchAggregationProfileDebug - children?: SearchAggregationProfileDebug[] + children?: SearchAggregationProfile[] } export interface SearchAggregationProfileDebug { - [key: string]: never + segments_with_multi_valued_ords?: integer + collection_strategy?: string + segments_with_single_valued_ords?: integer + total_buckets?: integer + built_buckets?: integer + result_strategy?: string + has_filter?: boolean + delegate?: string + delegate_debug?: SearchAggregationProfileDelegateDebug + chars_fetched?: integer + extract_count?: integer + extract_ns?: integer + values_fetched?: integer + collect_analyzed_ns?: integer + collect_analyzed_count?: integer + surviving_buckets?: integer + ordinals_collectors_used?: integer + ordinals_collectors_overhead_too_high?: integer + string_hashing_collectors_used?: integer + numeric_collectors_used?: integer + empty_collectors_used?: integer + deferred_aggregators?: string[] +} + +export interface SearchAggregationProfileDelegateDebug { + segments_with_doc_count_field?: integer + segments_with_deleted_docs?: integer + filters?: SearchAggregationProfileDelegateDebugFilter[] + segments_counted?: integer + segments_collected?: integer +} + +export interface SearchAggregationProfileDelegateDebugFilter { + results_from_metadata?: integer + query?: string + specialized_for?: string } export type SearchBoundaryScanner = 'chars' | 'sentence' | 'word' @@ -1125,6 +1154,29 @@ export interface SearchDocValueField { format?: string } +export interface SearchFetchProfile { + type: string + description: string + time_in_nanos: long + breakdown: SearchFetchProfileBreakdown + debug?: SearchFetchProfileDebug + children?: SearchFetchProfile[] +} + +export interface SearchFetchProfileBreakdown { + load_stored_fields?: integer + load_stored_fields_count?: integer + next_reader?: integer + next_reader_count?: integer + process_count?: integer + process?: integer +} + +export interface SearchFetchProfileDebug { + stored_fields?: string[] + fast_path?: integer +} + export interface SearchFieldAndFormat { field: Field format?: string @@ -1401,6 +1453,7 @@ export interface SearchShardProfile { aggregations: SearchAggregationProfile[] id: string searches: SearchSearchProfile[] + fetch?: SearchFetchProfile } export interface SearchSmoothingModelContainer { @@ -1541,7 +1594,7 @@ export type SearchMvtResponse = MapboxVectorTiles export type SearchMvtCoordinate = integer -export type SearchMvtGridType = 'grid' | 'point' +export type SearchMvtGridType = 'grid' | 'point' | 'centroid' export type SearchMvtZoomLevel = integer @@ -1809,7 +1862,7 @@ export interface AcknowledgedResponseBase { export type AggregateName = string export interface BulkIndexByScrollFailure { - cause: MainError + cause: ErrorCause | string id: Id index: IndexName status: integer @@ -1903,42 +1956,20 @@ export interface EmptyObject { export type EpochMillis = string | long -export interface ErrorCause { - type: string +export interface ErrorCauseKeys { + type?: string reason: string - caused_by?: ErrorCause - shard?: integer | string stack_trace?: string - root_cause?: ErrorCause[] - bytes_limit?: long - bytes_wanted?: long - column?: integer - col?: integer - failed_shards?: ShardFailure[] - grouped?: boolean - index?: IndexName - index_uuid?: Uuid - language?: string - licensed_expired_feature?: string - line?: integer - max_buckets?: integer - phase?: string - property_name?: string - processor_type?: string - resource_id?: Ids - 'resource.id'?: Ids - resource_type?: string - 'resource.type'?: string - script?: string - script_stack?: string[] - header?: HttpHeaders - lang?: string - position?: ScriptsPainlessExecutePainlessExecutionPosition + caused_by?: ErrorCause | string + root_cause: (ErrorCause | string)[] + suppressed?: (ErrorCause | string)[] } +export type ErrorCause = ErrorCauseKeys | +{ [property: string]: any } export interface ErrorResponseBase { - error: MainError | string - status?: integer + error: ErrorCause | string + status: integer } export type ExpandWildcardOptions = 'all' | 'open' | 'closed' | 'hidden' | 'none' @@ -2069,10 +2100,6 @@ export type Level = 'cluster' | 'indices' | 'shards' export type LifecycleOperationMode = 'RUNNING' | 'STOPPING' | 'STOPPED' -export interface MainError extends ErrorCause { - headers?: Record -} - export type MapboxVectorTiles = ArrayBuffer export interface MergesStats { @@ -2139,7 +2166,7 @@ export interface NodeShard { } export interface NodeStatistics { - failures?: ErrorCause[] + failures?: (ErrorCause | string)[] total: integer successful: integer failed: integer @@ -2302,7 +2329,7 @@ export type ShapeRelation = 'intersects' | 'disjoint' | 'within' export interface ShardFailure { index?: IndexName node?: string - reason: ErrorCause + reason: ErrorCause | string shard: integer status?: string } @@ -2596,10 +2623,6 @@ export interface AggregationsBucketSortAggregation extends AggregationsAggregati sort?: SearchSort } -export interface AggregationsBucketsPath { - [key: string]: never -} - export interface AggregationsCardinalityAggregation extends AggregationsMetricAggregationBase { precision_threshold?: integer rehash?: boolean @@ -2837,7 +2860,7 @@ export interface AggregationsGlobalAggregation extends AggregationsBucketAggrega } export interface AggregationsGoogleNormalizedDistanceHeuristic { - background_is_superset: boolean + background_is_superset?: boolean } export interface AggregationsHdrMethod { @@ -2985,6 +3008,8 @@ export interface AggregationsMissingAggregation extends AggregationsBucketAggreg missing?: AggregationsMissing } +export type AggregationsMissingOrder = 'first' | 'last' | 'default' + export interface AggregationsMovingAverageAggregation extends AggregationsPipelineAggregationBase { minimize?: boolean model?: AggregationsMovingAverageModel @@ -3022,8 +3047,8 @@ export interface AggregationsMultiTermsAggregation extends AggregationsBucketAgg } export interface AggregationsMutualInformationHeuristic { - background_is_superset: boolean - include_negatives: boolean + background_is_superset?: boolean + include_negatives?: boolean } export interface AggregationsNestedAggregation extends AggregationsBucketAggregationBase { @@ -3072,13 +3097,14 @@ export interface AggregationsPercentilesBucketAggregation extends AggregationsPi } export interface AggregationsPipelineAggregationBase extends AggregationsAggregation { - buckets_path?: AggregationsBucketsPath + buckets_path?: string | string[] | Record format?: string gap_policy?: AggregationsGapPolicy } export interface AggregationsRangeAggregation extends AggregationsBucketAggregationBase { field?: Field + missing?: integer ranges?: AggregationsAggregationRange[] script?: Script keyed?: boolean @@ -3269,6 +3295,7 @@ export interface AggregationsTermsAggregation extends AggregationsBucketAggregat include?: string | string[] | AggregationsTermsInclude min_doc_count?: integer missing?: AggregationsMissing + missing_order?: AggregationsMissingOrder missing_bucket?: boolean value_type?: string order?: AggregationsTermsAggregationOrder @@ -3533,7 +3560,7 @@ export interface AnalysisKeywordTokenizer extends AnalysisTokenizerBase { export interface AnalysisKuromojiAnalyzer { type: 'kuromoji' mode: AnalysisKuromojiTokenizationMode - user_dictionary: string + user_dictionary?: string } export interface AnalysisKuromojiPartOfSpeechTokenFilter extends AnalysisTokenFilterBase { @@ -3590,6 +3617,10 @@ export interface AnalysisLimitTokenCountTokenFilter extends AnalysisTokenFilterB max_token_count: integer } +export interface AnalysisLowercaseNormalizer { + type: 'lowercase' +} + export interface AnalysisLowercaseTokenFilter extends AnalysisTokenFilterBase { type: 'lowercase' language: string @@ -3602,7 +3633,7 @@ export interface AnalysisLowercaseTokenizer extends AnalysisTokenizerBase { export interface AnalysisMappingCharFilter extends AnalysisCharFilterBase { type: 'mapping' mappings: string[] - mappings_path: string + mappings_path?: string } export interface AnalysisMultiplexerTokenFilter extends AnalysisTokenFilterBase { @@ -3648,6 +3679,8 @@ export interface AnalysisNoriTokenizer extends AnalysisTokenizerBase { user_dictionary_rules: string[] } +export type AnalysisNormalizer = AnalysisLowercaseNormalizer | AnalysisCustomNormalizer + export interface AnalysisPathHierarchyTokenizer extends AnalysisTokenizerBase { type: 'path_hierarchy' buffer_size: integer @@ -3772,13 +3805,13 @@ export interface AnalysisSynonymGraphTokenFilter extends AnalysisTokenFilterBase export interface AnalysisSynonymTokenFilter extends AnalysisTokenFilterBase { type: 'synonym' - expand: boolean - format: AnalysisSynonymFormat - lenient: boolean + expand?: boolean + format?: AnalysisSynonymFormat + lenient?: boolean synonyms: string[] - synonyms_path: string - tokenizer: string - updateable: boolean + synonyms_path?: string + tokenizer?: string + updateable?: boolean } export type AnalysisTokenChar = 'letter' | 'digit' | 'whitespace' | 'punctuation' | 'symbol' | 'custom' @@ -3976,7 +4009,8 @@ export interface MappingFieldAliasProperty extends MappingPropertyBase { } export interface MappingFieldMapping { - [key: string]: never + full_name: string + mapping: Record } export interface MappingFieldNamesField { @@ -4017,7 +4051,7 @@ export interface MappingGenericProperty extends MappingDocValuesPropertyBase { type: string } -export type MappingGeoOrientation = 'right' | 'RIGHT' | 'counterclockwise' | 'COUNTERCLOCKWISE' | 'ccw' | 'CCW' | 'left' | 'LEFT' | 'clockwise' | 'CLOCKWISE' | 'cw' | 'CW' +export type MappingGeoOrientation = 'right' | 'left' export interface MappingGeoPointProperty extends MappingDocValuesPropertyBase { ignore_malformed?: boolean @@ -4056,6 +4090,7 @@ export interface MappingIpProperty extends MappingDocValuesPropertyBase { boost?: double index?: boolean null_value?: string + ignore_malformed?: boolean type: 'ip' } @@ -4181,13 +4216,11 @@ export interface MappingSearchAsYouTypeProperty extends MappingCorePropertyBase type: 'search_as_you_type' } -export type MappingShapeOrientation = 'right' | 'counterclockwise' | 'ccw' | 'left' | 'clockwise' | 'cw' - export interface MappingShapeProperty extends MappingDocValuesPropertyBase { coerce?: boolean ignore_malformed?: boolean ignore_z_value?: boolean - orientation?: MappingShapeOrientation + orientation?: MappingGeoOrientation type: 'shape' } @@ -4259,6 +4292,7 @@ export interface MappingTypeMapping { _size?: MappingSizeField _source?: MappingSourceField runtime?: Record + enabled?: boolean } export interface MappingVersionProperty extends MappingDocValuesPropertyBase { @@ -4337,6 +4371,8 @@ export interface QueryDslDateRangeQuery extends QueryDslRangeQueryBase { gte?: DateMath lt?: DateMath lte?: DateMath + from?: DateMath + to?: DateMath format?: DateFormat time_zone?: TimeZone } @@ -4417,7 +4453,7 @@ export interface QueryDslFuzzyQuery extends QueryDslQueryBase { rewrite?: MultiTermQueryRewrite transpositions?: boolean fuzziness?: Fuzziness - value: string + value: string | double | boolean } export interface QueryDslGeoBoundingBoxQueryKeys extends QueryDslQueryBase { @@ -4691,6 +4727,8 @@ export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { gte?: double lt?: double lte?: double + from?: double + to?: double } export interface QueryDslNumericDecayFunctionKeys extends QueryDslDecayFunctionBase { @@ -4718,9 +4756,15 @@ export interface QueryDslPercolateQuery extends QueryDslQueryBase { version?: VersionNumber } +export interface QueryDslPinnedDoc { + _id: Id + _index: IndexName +} + export interface QueryDslPinnedQuery extends QueryDslQueryBase { - ids: Id[] organic: QueryDslQueryContainer + ids?: Id[] + docs?: QueryDslPinnedDoc[] } export interface QueryDslPrefixQuery extends QueryDslQueryBase { @@ -4744,7 +4788,7 @@ export interface QueryDslQueryContainer { distance_feature?: QueryDslDistanceFeatureQuery exists?: QueryDslExistsQuery function_score?: QueryDslFunctionScoreQuery - fuzzy?: Record + fuzzy?: Record geo_bounding_box?: QueryDslGeoBoundingBoxQuery geo_distance?: QueryDslGeoDistanceQuery geo_polygon?: QueryDslGeoPolygonQuery @@ -6953,7 +6997,7 @@ export interface CcrFollowIndexStats { } export interface CcrReadException { - exception: ErrorCause + exception: ErrorCause | string from_seq_no: SequenceNumber retries: integer } @@ -6962,7 +7006,7 @@ export interface CcrShardStats { bytes_read: long failed_read_requests: long failed_write_requests: long - fatal_exception?: ErrorCause + fatal_exception?: ErrorCause | string follower_aliases_version: VersionNumber follower_global_checkpoint: long follower_index: string @@ -7170,7 +7214,7 @@ export interface CcrStatsAutoFollowStats { number_of_failed_follow_indices: long number_of_failed_remote_cluster_state_requests: long number_of_successful_follow_indices: long - recent_auto_follow_errors: ErrorCause[] + recent_auto_follow_errors: (ErrorCause | string)[] } export interface CcrStatsAutoFollowedCluster { @@ -8150,8 +8194,9 @@ export interface IlmAction { } export interface IlmPhase { - actions: Record | string[] + actions?: Record | string[] min_age?: Time + configurations?: Record> } export interface IlmPhases { @@ -8313,6 +8358,10 @@ export interface IndicesAliasDefinition { search_routing?: string } +export interface IndicesDataStream { + hidden?: boolean +} + export type IndicesDataStreamHealthStatus = 'green' | 'yellow' | 'red' export interface IndicesFielddataFrequencyFilter { @@ -8358,15 +8407,10 @@ export type IndicesIndexRoutingRebalanceOptions = 'all' | 'primaries' | 'replica export interface IndicesIndexSettingBlocks { read_only?: boolean - 'index.blocks.read_only'?: boolean read_only_allow_delete?: boolean - 'index.blocks.read_only_allow_delete'?: boolean read?: boolean - 'index.blocks.read'?: boolean write?: boolean | string - 'index.blocks.write'?: boolean | string metadata?: boolean - 'index.blocks.metadata'?: boolean } export interface IndicesIndexSettings { @@ -8410,6 +8454,16 @@ export interface IndicesIndexSettings { 'index.max_shingle_diff'?: integer blocks?: IndicesIndexSettingBlocks 'index.blocks'?: IndicesIndexSettingBlocks + 'blocks.read_only'?: boolean + 'index.blocks.read_only'?: boolean + 'blocks.read_only_allow_delete'?: boolean + 'index.blocks.read_only_allow_delete'?: boolean + 'blocks.read'?: boolean + 'index.blocks.read'?: boolean + 'blocks.write'?: boolean | string + 'index.blocks.write'?: boolean | string + 'blocks.metadata'?: boolean + 'index.blocks.metadata'?: boolean max_refresh_listeners?: integer 'index.max_refresh_listeners'?: integer 'analyze.max_token_count'?: integer @@ -8430,6 +8484,8 @@ export interface IndicesIndexSettings { 'index.final_pipeline'?: PipelineName lifecycle?: IndicesIndexSettingsLifecycle 'index.lifecycle'?: IndicesIndexSettingsLifecycle + 'lifecycle.name'?: string + 'index.lifecycle.name'?: string provided_name?: Name 'index.provided_name'?: Name creation_date?: DateString @@ -8452,13 +8508,14 @@ export interface IndicesIndexSettings { 'index.priority'?: integer | string top_metrics_max_size?: integer analysis?: IndicesIndexSettingsAnalysis + settings?: IndicesIndexSettings } export interface IndicesIndexSettingsAnalysis { analyzer?: Record char_filter?: Record filter?: Record - normalizer?: Record + normalizer?: Record } export interface IndicesIndexSettingsLifecycle { @@ -8665,9 +8722,10 @@ export interface IndicesCreateRequest extends RequestBase { } } -export interface IndicesCreateResponse extends AcknowledgedResponseBase { +export interface IndicesCreateResponse { index: IndexName shards_acknowledged: boolean + acknowledged?: boolean } export interface IndicesCreateDataStreamRequest extends RequestBase { @@ -8931,7 +8989,7 @@ export interface IndicesGetFieldMappingTypeFieldMappings { export interface IndicesGetIndexTemplateIndexTemplate { index_patterns: Name[] composed_of: Name[] - template: IndicesGetIndexTemplateIndexTemplateSummary + template?: IndicesGetIndexTemplateIndexTemplateSummary version?: VersionNumber priority?: long _meta?: Metadata @@ -9064,7 +9122,7 @@ export interface IndicesPutIndexTemplateRequest extends RequestBase { index_patterns?: Indices composed_of?: Name[] template?: IndicesPutIndexTemplateIndexTemplateMapping - data_stream?: EmptyObject + data_stream?: IndicesDataStream priority?: integer version?: VersionNumber _meta?: Metadata @@ -12262,7 +12320,7 @@ export interface MonitoringBulkRequest extends RequestBase { } export interface MonitoringBulkResponse { - error?: ErrorCause + error?: ErrorCause | string errors: boolean ignored: boolean took: long @@ -13721,7 +13779,7 @@ export interface SecurityInvalidateApiKeyRequest extends RequestBase { export interface SecurityInvalidateApiKeyResponse { error_count: integer - error_details?: ErrorCause[] + error_details?: (ErrorCause | string)[] invalidated_api_keys: string[] previously_invalidated_api_keys: string[] } @@ -13738,7 +13796,7 @@ export interface SecurityInvalidateTokenRequest extends RequestBase { export interface SecurityInvalidateTokenResponse { error_count: long - error_details?: ErrorCause[] + error_details?: (ErrorCause | string)[] invalidated_tokens: long previously_invalidated_tokens: long } @@ -14232,7 +14290,7 @@ export interface SnapshotGetResponse { export interface SnapshotGetSnapshotResponseItem { repository: Name snapshots?: SnapshotSnapshotInfo[] - error?: ErrorCause + error?: ErrorCause | string } export interface SnapshotGetRepositoryRequest extends RequestBase { @@ -14432,7 +14490,7 @@ export interface TasksCancelRequest extends RequestBase { } export interface TasksCancelResponse { - node_failures?: ErrorCause[] + node_failures?: (ErrorCause | string)[] nodes: Record } @@ -14446,7 +14504,7 @@ export interface TasksGetResponse { completed: boolean task: TasksInfo response?: TasksStatus - error?: ErrorCause + error?: ErrorCause | string } export interface TasksListRequest extends RequestBase { @@ -14460,7 +14518,7 @@ export interface TasksListRequest extends RequestBase { } export interface TasksListResponse { - node_failures?: ErrorCause[] + node_failures?: (ErrorCause | string)[] nodes?: Record tasks?: Record | TasksInfo[] } @@ -15388,7 +15446,7 @@ export interface XpackInfoFeatures { spatial: XpackInfoFeature sql: XpackInfoFeature transform: XpackInfoFeature - vectors: XpackInfoFeature + vectors?: XpackInfoFeature voting_only: XpackInfoFeature watcher: XpackInfoFeature } @@ -15417,6 +15475,14 @@ export interface XpackInfoResponse { tagline: string } +export interface XpackUsageAllJobs { + count: integer + detectors: Record + created_by: Record + model_size: Record + forecasts: Record +} + export interface XpackUsageAnalytics extends XpackUsageBase { stats: XpackUsageAnalyticsStatistics } @@ -15565,7 +15631,7 @@ export interface XpackUsageKibanaUrlConfig extends XpackUsageBaseUrlConfig { export interface XpackUsageMachineLearning extends XpackUsageBase { datafeeds: Record - jobs: Record + jobs: Record | Record node_count: integer data_frame_analytics_jobs: XpackUsageMlDataFrameAnalyticsJobs inference: XpackUsageMlInference @@ -15679,7 +15745,7 @@ export interface XpackUsageResponse { slm: XpackUsageSlm sql: XpackUsageSql transform: XpackUsageBase - vectors: XpackUsageVector + vectors?: XpackUsageVector voting_only: XpackUsageBase }