Skip to content

Commit

Permalink
Updated opensearch-js to reflect the latest OpenSearch API spec (2024…
Browse files Browse the repository at this point in the history
…-12-08)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
nhtruong authored and github-actions[bot] committed Dec 8, 2024
1 parent fc7bc20 commit db63013
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 105 deletions.
1 change: 1 addition & 0 deletions api/_core/searchTemplate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type SearchTemplate_ResponseBody = {
num_reduce_phases?: number;
pit_id?: Common.Id;
profile?: Core_Search.Profile;
status?: number;
suggest?: Record<string, Core_Search.Suggest[]>;
terminated_early?: boolean;
timed_out: boolean;
Expand Down
40 changes: 16 additions & 24 deletions api/_types/_common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -202,11 +203,19 @@ export type FieldSizeUsage = {
size_in_bytes: ByteCount;
}

export type FieldValue = boolean | undefined | number | Record<string, any> | 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<string, SortOrder>
export type FieldSortNumericType = 'date' | 'date_nanos' | 'double' | 'long'

export type FieldWithOrder = Record<string, ScoreSort>
export type FieldValue = boolean | undefined | number | string

export type FlushStats = {
periodic: number;
Expand Down Expand Up @@ -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<string, number>;
min_score?: number;
rescore?: Record<string, number>;
vector: QueryVector;
}

export type LatLonGeoLocation = {
lat: number;
lon: number;
Expand Down Expand Up @@ -384,7 +382,7 @@ export type Metadata = Record<string, any>

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

Expand Down Expand Up @@ -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;
Expand All @@ -495,8 +491,6 @@ export type QueryCacheStats = {
total_count: number;
}

export type QueryVector = number[]

export type RankBase = Record<string, any>

export type RankContainer = {
Expand Down Expand Up @@ -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<string, FieldSort>

export type SortOrder = 'asc' | 'desc'

Expand Down
2 changes: 2 additions & 0 deletions api/_types/_common.mapping.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit db63013

Please sign in to comment.