diff --git a/api/_core/searchTemplate.d.ts b/api/_core/searchTemplate.d.ts index e35f2bab8..32926d625 100644 --- a/api/_core/searchTemplate.d.ts +++ b/api/_core/searchTemplate.d.ts @@ -61,6 +61,7 @@ export type SearchTemplate_ResponseBody = { num_reduce_phases?: number; pit_id?: Common.Id; profile?: Core_Search.Profile; + status?: number; suggest?: Record; terminated_early?: boolean; timed_out: boolean; diff --git a/api/_types/_common.d.ts b/api/_types/_common.d.ts index aad183307..473575c74 100644 --- a/api/_types/_common.d.ts +++ b/api/_types/_common.d.ts @@ -15,6 +15,7 @@ */ import * as Cluster_AllocationExplain from './cluster.allocation_explain' +import * as Common_Mapping from './_common.mapping' import * as Common_QueryDsl from './_common.query_dsl' import * as Indices_Stats from './indices.stats' @@ -202,11 +203,19 @@ export type FieldSizeUsage = { size_in_bytes: ByteCount; } -export type FieldValue = boolean | undefined | number | Record | string +export type FieldSort = SortOrder | { + format?: string; + missing?: FieldValue; + mode?: SortMode; + nested?: NestedSortValue; + numeric_type?: FieldSortNumericType; + order?: SortOrder; + unmapped_type?: Common_Mapping.FieldType; +} -export type FieldWithDirection = Record +export type FieldSortNumericType = 'date' | 'date_nanos' | 'double' | 'long' -export type FieldWithOrder = Record +export type FieldValue = boolean | undefined | number | string export type FlushStats = { periodic: number; @@ -342,17 +351,6 @@ export type InlineScript = string | (ScriptBase & { export type Ip = string -export type KnnField = { - boost?: number; - filter?: Common_QueryDsl.QueryContainer | Common_QueryDsl.QueryContainer[]; - k?: number; - max_distance?: number; - method_parameters?: Record; - min_score?: number; - rescore?: Record; - vector: QueryVector; -} - export type LatLonGeoLocation = { lat: number; lon: number; @@ -384,7 +382,7 @@ export type Metadata = Record export type MinimumShouldMatch = number | string -export type MultiTermQueryRewrite = 'constant_score' | 'constant_score_boolean' | 'scoring_boolean' | 'top_terms_N' | 'top_terms_blended_freqs_N' | 'top_terms_boost_N' +export type MultiTermQueryRewrite = 'constant_score' | 'constant_score_boolean' | 'scoring_boolean' | string export type Name = string @@ -469,8 +467,6 @@ export type PhaseTook = { export type PipelineName = string -export type PipeSeparatedFlagsSimpleQueryStringFlag = Common_QueryDsl.SimpleQueryStringFlag | string - export type PluginStats = { classname: string; custom_foldername?: undefined | string; @@ -495,8 +491,6 @@ export type QueryCacheStats = { total_count: number; } -export type QueryVector = number[] - export type RankBase = Record export type RankContainer = { @@ -783,18 +777,16 @@ export type Slices = number | SlicesCalculation export type SlicesCalculation = 'auto' -export type Sort = SortCombinations | SortCombinations[] - -export type SortCombinations = Field | FieldWithDirection | FieldWithOrder | SortOptions +export type Sort = SortOptions | SortOptions[] export type SortMode = 'avg' | 'max' | 'median' | 'min' | 'sum' -export type SortOptions = { +export type SortOptions = '_score' | '_doc' | string | { _doc?: ScoreSort; _geo_distance?: GeoDistanceSort; _score?: ScoreSort; _script?: ScriptSort; -} +} | Record export type SortOrder = 'asc' | 'desc' diff --git a/api/_types/_common.mapping.d.ts b/api/_types/_common.mapping.d.ts index 7b327c418..2d644e924 100644 --- a/api/_types/_common.mapping.d.ts +++ b/api/_types/_common.mapping.d.ts @@ -145,6 +145,8 @@ export type FieldNamesField = { enabled: boolean; } +export type FieldType = 'aggregate_metric_double' | 'alias' | 'binary' | 'boolean' | 'byte' | 'completion' | 'constant_keyword' | 'date' | 'date_nanos' | 'date_range' | 'double' | 'double_range' | 'flat_object' | 'float' | 'float_range' | 'geo_point' | 'geo_shape' | 'half_float' | 'histogram' | 'icu_collation_keyword' | 'integer' | 'integer_range' | 'ip' | 'ip_range' | 'join' | 'keyword' | 'knn_vector' | 'long' | 'long_range' | 'match_only_text' | 'murmur3' | 'nested' | 'object' | 'percolator' | 'rank_feature' | 'rank_features' | 'scaled_float' | 'search_as_you_type' | 'short' | 'text' | 'token_count' | 'unsigned_long' | 'version' | 'wildcard' | 'xy_point' | 'xy_shape' + export type FlatObjectProperty = PropertyBase & { aggregatable?: boolean; searchable?: boolean; diff --git a/api/_types/_common.query_dsl.d.ts b/api/_types/_common.query_dsl.d.ts index 7e5a4425c..ff863eaf5 100644 --- a/api/_types/_common.query_dsl.d.ts +++ b/api/_types/_common.query_dsl.d.ts @@ -48,14 +48,14 @@ export type CombinedFieldsQuery = QueryBase & { export type CombinedFieldsZeroTerms = 'all' | 'none' -export type CommonTermsQuery = QueryBase & { +export type CommonTermsQuery = string | (QueryBase & { analyzer?: string; cutoff_frequency?: number; high_freq_operator?: Operator; low_freq_operator?: Operator; minimum_should_match?: Common.MinimumShouldMatch; query: string; -} +}) export type ConstantScoreQuery = QueryBase & { filter: QueryContainer; @@ -105,7 +105,7 @@ export type ExistsQuery = QueryBase & { field: Common.Field; } -export type FieldAndFormat = { +export type FieldAndFormat = Common.Field | { field: Common.Field; format?: string; include_unmapped?: boolean; @@ -144,14 +144,14 @@ export type FunctionScoreQuery = QueryBase & { score_mode?: FunctionScoreMode; } -export type FuzzyQuery = QueryBase & { +export type FuzzyQuery = Common.FieldValue | (QueryBase & { fuzziness?: Common.Fuzziness; max_expansions?: number; prefix_length?: number; rewrite?: Common.MultiTermQueryRewrite; transpositions?: boolean; - value: string | number | boolean; -} + value: Common.FieldValue; +}) export type GeoBoundingBoxQuery = QueryBase & { ignore_unmapped?: IgnoreUnmapped; @@ -214,6 +214,10 @@ export type HasParentQuery = QueryBase & { score?: boolean; } +export type HybridQuery = QueryBase & { + queries?: QueryContainer[]; +} + export type IdsQuery = QueryBase & { values?: Common.Ids; } @@ -292,13 +296,22 @@ export type IntervalsWildcard = { use_field?: Common.Field; } -export type KnnQuery = Record +export type KnnQuery = QueryBase & { + filter?: QueryContainer | QueryContainer[]; + k?: number; + max_distance?: number; + method_parameters?: Record; + min_score?: number; + rescore?: Record; + vector: QueryVector; +} export type Like = string | LikeDocument export type LikeDocument = { _id?: Common.Id; _index?: Common.IndexName; + _type?: Common.Type; doc?: Record; fields?: Common.Field[]; per_field_analyzer?: Record; @@ -307,9 +320,9 @@ export type LikeDocument = { version_type?: Common.VersionType; } -export type MatchAllQuery = QueryBase +export type MatchAllQuery = QueryBase & Record -export type MatchBoolPrefixQuery = QueryBase & { +export type MatchBoolPrefixQuery = string | (QueryBase & { analyzer?: string; fuzziness?: Common.Fuzziness; fuzzy_rewrite?: Common.MultiTermQueryRewrite; @@ -319,26 +332,26 @@ export type MatchBoolPrefixQuery = QueryBase & { operator?: Operator; prefix_length?: number; query: string; -} +}) export type MatchNoneQuery = QueryBase & Record -export type MatchPhrasePrefixQuery = QueryBase & { +export type MatchPhrasePrefixQuery = string | (QueryBase & { analyzer?: string; max_expansions?: number; query: string; slop?: number; zero_terms_query?: ZeroTermsQuery; -} +}) -export type MatchPhraseQuery = QueryBase & { +export type MatchPhraseQuery = string | (QueryBase & { analyzer?: string; query: string; slop?: number; zero_terms_query?: ZeroTermsQuery; -} +}) -export type MatchQuery = QueryBase & { +export type MatchQuery = Common.FieldValue | (QueryBase & { analyzer?: string; auto_generate_synonyms_phrase_query?: boolean; cutoff_frequency?: number; @@ -350,9 +363,9 @@ export type MatchQuery = QueryBase & { minimum_should_match?: Common.MinimumShouldMatch; operator?: Operator; prefix_length?: number; - query: string | number | boolean; + query: Common.FieldValue; zero_terms_query?: ZeroTermsQuery; -} +}) export type MoreLikeThisQuery = QueryBase & { analyzer?: string; @@ -406,9 +419,7 @@ export type NestedQuery = QueryBase & { score_mode?: ChildScoreMode; } -export type NeuralQuery = QueryBase & Record - -export type NeuralQueryVectorField = { +export type NeuralQuery = QueryBase & { filter?: QueryContainer; k?: number; max_distance?: number; @@ -429,7 +440,7 @@ export type NumberRangeQuery = RangeQueryBase & { export type NumericDecayFunction = DecayFunctionBase & Record -export type Operator = 'and' | 'or' +export type Operator = 'and' | 'AND' | 'or' | 'OR' export type ParentIdQuery = QueryBase & { id?: Common.Id; @@ -439,7 +450,7 @@ export type ParentIdQuery = QueryBase & { export type PercolateQuery = QueryBase & { document?: Record; - documents?: Record[]; + documents?: any[]; field: Common.Field; id?: Common.Id; index?: Common.IndexName; @@ -456,11 +467,11 @@ export type PinnedDoc = { export type PinnedQuery = QueryBase & Record -export type PrefixQuery = QueryBase & { +export type PrefixQuery = string | (QueryBase & { case_insensitive?: boolean; rewrite?: Common.MultiTermQueryRewrite; value: string; -} +}) export type QueryBase = { _name?: string; @@ -485,10 +496,11 @@ export type QueryContainer = { geo_shape?: GeoShapeQuery; has_child?: HasChildQuery; has_parent?: HasParentQuery; + hybrid?: HybridQuery; ids?: IdsQuery; intervals?: Record; - knn?: KnnQuery; - match?: Record; + knn?: Record; + match?: Record; match_all?: MatchAllQuery; match_bool_prefix?: Record; match_none?: MatchNoneQuery; @@ -497,7 +509,7 @@ export type QueryContainer = { more_like_this?: MoreLikeThisQuery; multi_match?: MultiMatchQuery; nested?: NestedQuery; - neural?: NeuralQuery; + neural?: Record; parent_id?: ParentIdQuery; percolate?: PercolateQuery; pinned?: PinnedQuery; @@ -506,7 +518,6 @@ export type QueryContainer = { range?: Record; rank_feature?: RankFeatureQuery; regexp?: Record; - rule_query?: RuleQuery; script?: ScriptQuery; script_score?: ScriptScoreQuery; simple_query_string?: SimpleQueryStringQuery; @@ -518,12 +529,10 @@ export type QueryContainer = { span_or?: SpanOrQuery; span_term?: Record; span_within?: SpanWithinQuery; - term?: Record; - terms?: TermsQueryField; + term?: Record; + terms?: TermsQuery; terms_set?: Record; - text_expansion?: Record; type?: TypeQuery; - weighted_tokens?: Record; wildcard?: Record; wrapper?: WrapperQuery; xy_shape?: XyShapeQuery; @@ -557,6 +566,8 @@ export type QueryStringQuery = QueryBase & { type?: TextQueryType; } +export type QueryVector = number[] + export type RandomScoreFunction = { field?: Common.Field; seed?: number | string; @@ -595,19 +606,13 @@ export type RankFeatureQuery = QueryBase & { sigmoid?: RankFeatureFunctionSigmoid; } -export type RegexpQuery = QueryBase & { +export type RegexpQuery = string | (QueryBase & { case_insensitive?: boolean; flags?: string; max_determinized_states?: number; rewrite?: Common.MultiTermQueryRewrite; value: string; -} - -export type RuleQuery = QueryBase & { - match_criteria: Record; - organic: QueryContainer; - ruleset_id: Common.Id; -} +}) export type ScriptQuery = QueryBase & { script: Common.Script; @@ -625,7 +630,7 @@ export type ScriptScoreQuery = QueryBase & { export type SimpleQueryStringFlag = 'ALL' | 'AND' | 'ESCAPE' | 'FUZZY' | 'NEAR' | 'NONE' | 'NOT' | 'OR' | 'PHRASE' | 'PRECEDENCE' | 'PREFIX' | 'SLOP' | 'WHITESPACE' -export type SimpleQueryStringFlags = Common.PipeSeparatedFlagsSimpleQueryStringFlag +export type SimpleQueryStringFlags = SimpleQueryStringFlag | string export type SimpleQueryStringQuery = QueryBase & { analyze_wildcard?: boolean; @@ -695,67 +700,53 @@ export type SpanQuery = { span_within?: SpanWithinQuery; } -export type SpanTermQuery = QueryBase & { +export type SpanTermQuery = string | (QueryBase & { value: string; -} +}) export type SpanWithinQuery = QueryBase & { big: SpanQuery; little: SpanQuery; } -export type TermQuery = QueryBase & { +export type TermQuery = Common.FieldValue | (QueryBase & { case_insensitive?: boolean; value: Common.FieldValue; -} +}) -export type TermsLookupField = { +export type TermsLookup = { id?: Common.Id; index?: Common.IndexName; path?: Common.Field; routing?: Common.Routing; } -export type TermsQueryField = { - boost?: number; - [key: string]: any | TermsLookupField | string[]; +export type TermsQuery = QueryBase & { + _name?: any; + boost?: any; + [key: string]: any | TermsQueryField; } +export type TermsQueryField = Common.FieldValue[] | TermsLookup + export type TermsSetQuery = QueryBase & { minimum_should_match_field?: Common.Field; minimum_should_match_script?: Common.Script; terms: string[]; } -export type TextExpansionQuery = QueryBase & { - model_id: string; - model_text: string; - pruning_config?: TokenPruningConfig; -} - export type TextQueryType = 'best_fields' | 'bool_prefix' | 'cross_fields' | 'most_fields' | 'phrase' | 'phrase_prefix' -export type TokenPruningConfig = { - only_score_pruned_tokens?: boolean; - tokens_freq_ratio_threshold?: number; - tokens_weight_threshold?: number; -} - export type TypeQuery = QueryBase & { value: string; } -export type WeightedTokensQuery = QueryBase & { - pruning_config?: TokenPruningConfig; - tokens: Record; -} - -export type WildcardQuery = QueryBase & { +export type WildcardQuery = string | (QueryBase & { case_insensitive?: boolean; rewrite?: Common.MultiTermQueryRewrite; value?: string; wildcard?: string; -} +}) export type WrapperQuery = QueryBase & { query: string; diff --git a/api/_types/_core.rank_eval.d.ts b/api/_types/_core.rank_eval.d.ts index 643dbf6af..b91048923 100644 --- a/api/_types/_core.rank_eval.d.ts +++ b/api/_types/_core.rank_eval.d.ts @@ -27,6 +27,7 @@ export type RankEvalHit = { _id: Common.Id; _index: Common.IndexName; _score: number; + _type?: Common.Type; } export type RankEvalHitItem = { @@ -48,7 +49,7 @@ export type RankEvalMetricBase = { export type RankEvalMetricDetail = { hits: RankEvalHitItem[]; - metric_details: Record>>; + metric_details: Record>; metric_score: number; unrated_docs: UnratedDocument[]; } diff --git a/api/_types/_core.search.d.ts b/api/_types/_core.search.d.ts index 76f322fbe..fcbd4cc77 100644 --- a/api/_types/_core.search.d.ts +++ b/api/_types/_core.search.d.ts @@ -84,7 +84,7 @@ export type AggregationProfileDelegateDebugFilter = { export type BoundaryScanner = 'chars' | 'sentence' | 'word' -export type BuiltinHighlighterType = 'fvh' | 'plain' | 'unified' +export type BuiltinHighlighterType = 'plain' | 'fvh' | 'unified' export type Collector = { children?: Collector[]; @@ -154,11 +154,12 @@ export type HighlightBase = { boundary_scanner?: BoundaryScanner; boundary_scanner_locale?: string; force_source?: boolean; + fragment_offset?: number; fragment_size?: number; fragmenter?: HighlighterFragmenter; highlight_filter?: boolean; highlight_query?: Common_QueryDsl.QueryContainer; - max_analyzed_offset?: number; + max_analyzer_offset?: number; max_fragment_length?: number; no_match_size?: number; number_of_fragments?: number; @@ -184,7 +185,6 @@ export type HighlighterType = BuiltinHighlighterType | string export type HighlightField = HighlightBase & { analyzer?: Common_Analysis.Analyzer; - fragment_offset?: number; matched_fields?: Common.Fields; } @@ -231,7 +231,7 @@ export type InnerHits = { seq_no_primary_term?: boolean; size?: number; sort?: Common.Sort; - stored_field?: Common.Fields; + stored_fields?: Common.Fields; track_scores?: boolean; version?: boolean; } @@ -340,11 +340,11 @@ export type ShardProfile = { searches: SearchProfile[]; } -export type SourceConfig = boolean | Common.Field[] | SourceFilter +export type SourceConfig = boolean | SourceFilter export type SourceConfigParam = boolean | Common.Fields -export type SourceFilter = { +export type SourceFilter = Common.Fields | { excludes?: Common.Fields; includes?: Common.Fields; } diff --git a/api/_types/indices._common.d.ts b/api/_types/indices._common.d.ts index 3ed165d95..31102f6f7 100644 --- a/api/_types/indices._common.d.ts +++ b/api/_types/indices._common.d.ts @@ -90,6 +90,13 @@ export type IndexErrorCause = { [key: string]: any | Record; } +export type IndexGetUpgradeStatus = { + indices?: Record; + size_in_bytes?: Common.ByteCount; + size_to_upgrade_ancient_in_bytes?: Common.ByteCount; + size_to_upgrade_in_bytes?: Common.ByteCount; +} + export type IndexingPressure = { memory: IndexingPressureMemory; } @@ -109,6 +116,11 @@ export type IndexingSlowlogThresholds = { index?: SlowlogThresholdLevels; } +export type IndexPostUpgradeStatus = { + _shards?: Common.ShardStatistics; + upgraded_indices?: Record; +} + export type IndexRouting = { allocation?: IndexRoutingAllocation; rebalance?: IndexRoutingRebalance; @@ -569,7 +581,7 @@ export type TemplateMapping = { index_patterns: Common.Name[]; mappings: Common_Mapping.TypeMapping; order: number; - settings: Record>; + settings: Record; version?: Common.VersionNumber; } @@ -588,3 +600,21 @@ export type TranslogRetention = { size?: Common.HumanReadableByteCount; } +export type UpgradeRequest = { + allow_no_indices?: boolean; + expand_wildcards?: 'all' | 'closed' | 'none' | 'open'; + ignore_unavailable?: boolean; + wait_for_completion?: boolean; +} + +export type UpgradeStatus = { + size_in_bytes?: Common.ByteCount; + size_to_upgrade_ancient_in_bytes?: Common.ByteCount; + size_to_upgrade_in_bytes?: Common.ByteCount; +} + +export type UpgradeVersionStatus = { + oldest_lucene_segment_version?: Common.VersionString; + upgrade_version?: Common.VersionString; +} + diff --git a/api/_types/nodes.info.d.ts b/api/_types/nodes.info.d.ts index 111d4d47a..b939f1815 100644 --- a/api/_types/nodes.info.d.ts +++ b/api/_types/nodes.info.d.ts @@ -271,7 +271,7 @@ export type NodeInfoSettingsNode = { name: Common.Name; } -export type NodeInfoSettingsPlugins = Record +export type NodeInfoSettingsPlugins = Record export type NodeInfoSettingsTransport = { type: string; diff --git a/api/cat/snapshots.js b/api/cat/snapshots.js index 6343bf7c4..e7b2b068f 100644 --- a/api/cat/snapshots.js +++ b/api/cat/snapshots.js @@ -31,10 +31,10 @@ const { normalizeArguments, parsePathParam } = require('../utils'); * @param {boolean} [params.help=false] - Return help information. * @param {boolean} [params.ignore_unavailable=false] - If `true`, the response does not include information from unavailable snapshots. * @param {string} [params.master_timeout] DEPRECATED - Operation timeout for connection to cluster-manager node. + * @param {string} [params.repository] - A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, OpenSearch returns an error. * @param {array} [params.s] - Comma-separated list of column names or column aliases to sort by. * @param {string} [params.time] - The unit in which to display time values. * @param {boolean} [params.v=false] - Verbose mode. Display column headers. - * @param {string} [params.repository] - A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. If any repository fails during the request, OpenSearch returns an error. * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response diff --git a/api/indices/getUpgrade.d.ts b/api/indices/getUpgrade.d.ts index 9c2c48e04..d97be6142 100644 --- a/api/indices/getUpgrade.d.ts +++ b/api/indices/getUpgrade.d.ts @@ -17,6 +17,7 @@ import { ApiResponse } from '../../lib/Transport' import * as Common from '../_types/_common' import * as Global from '../_types/_global' +import * as Indices_Common from '../_types/indices._common' export type Indices_GetUpgrade_Request = Global.Params & { allow_no_indices?: boolean; @@ -29,5 +30,5 @@ export type Indices_GetUpgrade_Response = ApiResponse & { body: Indices_GetUpgrade_ResponseBody; } -export type Indices_GetUpgrade_ResponseBody = Record +export type Indices_GetUpgrade_ResponseBody = Indices_Common.IndexGetUpgradeStatus diff --git a/api/indices/putTemplate.d.ts b/api/indices/putTemplate.d.ts index 38800a810..16a1cf735 100644 --- a/api/indices/putTemplate.d.ts +++ b/api/indices/putTemplate.d.ts @@ -34,7 +34,7 @@ export type Indices_PutTemplate_RequestBody = { index_patterns?: string | string[]; mappings?: Common_Mapping.TypeMapping; order?: number; - settings?: Record>; + settings?: Record; version?: Common.VersionNumber; } diff --git a/api/indices/upgrade.d.ts b/api/indices/upgrade.d.ts index 270812137..761ee9eea 100644 --- a/api/indices/upgrade.d.ts +++ b/api/indices/upgrade.d.ts @@ -17,9 +17,11 @@ import { ApiResponse } from '../../lib/Transport' import * as Common from '../_types/_common' import * as Global from '../_types/_global' +import * as Indices_Common from '../_types/indices._common' export type Indices_Upgrade_Request = Global.Params & { allow_no_indices?: boolean; + body?: Indices_Common.UpgradeRequest; expand_wildcards?: Common.ExpandWildcards; ignore_unavailable?: boolean; index?: string[]; @@ -31,5 +33,5 @@ export type Indices_Upgrade_Response = ApiResponse & { body: Indices_Upgrade_ResponseBody; } -export type Indices_Upgrade_ResponseBody = Record +export type Indices_Upgrade_ResponseBody = Indices_Common.IndexPostUpgradeStatus diff --git a/api/indices/upgrade.js b/api/indices/upgrade.js index 43b18cb47..59aec09d1 100644 --- a/api/indices/upgrade.js +++ b/api/indices/upgrade.js @@ -31,6 +31,7 @@ const { normalizeArguments, parsePathParam } = require('../utils'); * @param {boolean} [params.only_ancient_segments] - If `true`, only ancient (an older Lucene major release) segments will be upgraded. * @param {boolean} [params.wait_for_completion=false] - Should this request wait until the operation has completed before returning. * @param {array} [params.index] - Comma-separated list of indexes; use `_all` or empty string to perform the operation on all indexes. + * @param {object} [params.body] * * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} * @param {function} [callback] - Callback that handles errors and response