Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AUTOCUT] Update opensearch-js to reflect the latest OpenSearch API spec (2025-01-09) #958

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions api/OpenSearchApi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,50 @@ export default class OpenSearchAPI {
updateConnector (params: API.Ml_UpdateConnector_Request, callback: callbackFn<API.Ml_UpdateConnector_Response>): TransportRequestCallback;
updateConnector (params: API.Ml_UpdateConnector_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_UpdateConnector_Response>): TransportRequestCallback;

getMemory (params?: API.Ml_GetMemory_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_GetMemory_Response>;
getMemory (callback: callbackFn<API.Ml_GetMemory_Response>): TransportRequestCallback;
getMemory (params: API.Ml_GetMemory_Request, callback: callbackFn<API.Ml_GetMemory_Response>): TransportRequestCallback;
getMemory (params: API.Ml_GetMemory_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_GetMemory_Response>): TransportRequestCallback;

createMemory (params?: API.Ml_CreateMemory_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_CreateMemory_Response>;
createMemory (callback: callbackFn<API.Ml_CreateMemory_Response>): TransportRequestCallback;
createMemory (params: API.Ml_CreateMemory_Request, callback: callbackFn<API.Ml_CreateMemory_Response>): TransportRequestCallback;
createMemory (params: API.Ml_CreateMemory_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_CreateMemory_Response>): TransportRequestCallback;

searchMemory (params?: API.Ml_SearchMemory_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_SearchMemory_Response>;
searchMemory (callback: callbackFn<API.Ml_SearchMemory_Response>): TransportRequestCallback;
searchMemory (params: API.Ml_SearchMemory_Request, callback: callbackFn<API.Ml_SearchMemory_Response>): TransportRequestCallback;
searchMemory (params: API.Ml_SearchMemory_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_SearchMemory_Response>): TransportRequestCallback;

deleteMemory (params: API.Ml_DeleteMemory_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_DeleteMemory_Response>;
deleteMemory (params: API.Ml_DeleteMemory_Request, callback: callbackFn<API.Ml_DeleteMemory_Response>): TransportRequestCallback;
deleteMemory (params: API.Ml_DeleteMemory_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_DeleteMemory_Response>): TransportRequestCallback;

updateMemory (params: API.Ml_UpdateMemory_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_UpdateMemory_Response>;
updateMemory (params: API.Ml_UpdateMemory_Request, callback: callbackFn<API.Ml_UpdateMemory_Response>): TransportRequestCallback;
updateMemory (params: API.Ml_UpdateMemory_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_UpdateMemory_Response>): TransportRequestCallback;

searchMessage (params: API.Ml_SearchMessage_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_SearchMessage_Response>;
searchMessage (params: API.Ml_SearchMessage_Request, callback: callbackFn<API.Ml_SearchMessage_Response>): TransportRequestCallback;
searchMessage (params: API.Ml_SearchMessage_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_SearchMessage_Response>): TransportRequestCallback;

getMessage (params?: API.Ml_GetMessage_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_GetMessage_Response>;
getMessage (callback: callbackFn<API.Ml_GetMessage_Response>): TransportRequestCallback;
getMessage (params: API.Ml_GetMessage_Request, callback: callbackFn<API.Ml_GetMessage_Response>): TransportRequestCallback;
getMessage (params: API.Ml_GetMessage_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_GetMessage_Response>): TransportRequestCallback;

createMessage (params: API.Ml_CreateMessage_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_CreateMessage_Response>;
createMessage (params: API.Ml_CreateMessage_Request, callback: callbackFn<API.Ml_CreateMessage_Response>): TransportRequestCallback;
createMessage (params: API.Ml_CreateMessage_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_CreateMessage_Response>): TransportRequestCallback;

updateMessage (params: API.Ml_UpdateMessage_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_UpdateMessage_Response>;
updateMessage (params: API.Ml_UpdateMessage_Request, callback: callbackFn<API.Ml_UpdateMessage_Response>): TransportRequestCallback;
updateMessage (params: API.Ml_UpdateMessage_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_UpdateMessage_Response>): TransportRequestCallback;

getMessageTraces (params: API.Ml_GetMessageTraces_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_GetMessageTraces_Response>;
getMessageTraces (params: API.Ml_GetMessageTraces_Request, callback: callbackFn<API.Ml_GetMessageTraces_Response>): TransportRequestCallback;
getMessageTraces (params: API.Ml_GetMessageTraces_Request, options: TransportRequestOptions, callback: callbackFn<API.Ml_GetMessageTraces_Response>): TransportRequestCallback;

registerModelGroup (params?: API.Ml_RegisterModelGroup_Request, options?: TransportRequestOptions): TransportRequestPromise<API.Ml_RegisterModelGroup_Response>;
registerModelGroup (callback: callbackFn<API.Ml_RegisterModelGroup_Response>): TransportRequestCallback;
registerModelGroup (params: API.Ml_RegisterModelGroup_Request, callback: callbackFn<API.Ml_RegisterModelGroup_Response>): TransportRequestCallback;
Expand Down
11 changes: 2 additions & 9 deletions api/_types/_common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export type byte = number

export type ByteCount = number

export type ByteUnit = 'b' | 'g' | 'gb' | 'k' | 'kb' | 'm' | 'mb' | 'p' | 'pb' | 't' | 'tb'
export type ByteUnit = 'b' | 'kb' | 'k' | 'mb' | 'm' | 'gb' | 'g' | 'tb' | 't' | 'pb' | 'p'

export type ClusterDetails = {
_shards?: ShardStatistics;
Expand Down Expand Up @@ -280,11 +280,6 @@ export type HealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RE

export type Host = string

export type HourAndMinute = {
hour: number[];
minute: number[];
}

export type HttpHeaders = Record<string, StringOrStringArray>

export type HumanReadableByteCount = string
Expand Down Expand Up @@ -633,8 +628,6 @@ export type RrfRank = RankBase & {
window_size?: number;
}

export type ScheduleTimeOfDay = string | HourAndMinute

export type ScoreSort = {
order?: SortOrder;
}
Expand Down Expand Up @@ -849,7 +842,7 @@ export type ThreadInfo = {

export type TimeOfDay = string

export type TimeUnit = 'd' | 'h' | 'm' | 'micros' | 'ms' | 'nanos' | 's'
export type TimeUnit = 'nanos' | 'micros' | 'ms' | 's' | 'm' | 'h' | 'd'

export type TimeZone = string

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,7 @@

import * as Common from './_common'

export type CatPitSegmentsRecord = {
committed?: string;
compound?: string;
'docs.count'?: string;
'docs.deleted'?: string;
generation?: string;
index?: string;
ip?: string;
prirep?: string;
searchable?: string;
segment?: string;
shard?: string;
size?: string;
'size.memory'?: string;
version?: string;
}

export type CatSegmentReplicationRecord = {
export type SegmentReplicationRecord = {
bytes?: string;
bytes_behind?: string;
bytes_fetched?: string;
Expand Down
2 changes: 1 addition & 1 deletion api/_types/cat.snapshots.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type SnapshotsRecord = {
reason?: string;
repository?: string;
start_epoch?: Common.StringifiedEpochTimeUnitSeconds;
start_time?: Common.ScheduleTimeOfDay;
start_time?: Common.TimeOfDay;
status?: string;
successful_shards?: string;
total_shards?: string;
Expand Down
43 changes: 3 additions & 40 deletions api/_types/ingest._common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as Common from './_common'
export type AppendProcessor = ProcessorBase & {
allow_duplicates?: boolean;
field: Common.Field;
value: Record<string, any>[];
value: any[];
}

export type AttachmentProcessor = ProcessorBase & {
Expand Down Expand Up @@ -97,16 +97,6 @@ export type DotExpanderProcessor = ProcessorBase & {

export type DropProcessor = ProcessorBase & Record<string, any>

export type EnrichProcessor = ProcessorBase & {
field: Common.Field;
ignore_missing?: boolean;
max_matches?: number;
override?: boolean;
policy_name: string;
shape_relation?: Common.GeoShapeRelation;
target_field: Common.Field;
}

export type FailProcessor = ProcessorBase & {
message: string;
}
Expand Down Expand Up @@ -142,31 +132,6 @@ export type GsubProcessor = ProcessorBase & {
target_field?: Common.Field;
}

export type InferenceConfig = {
classification?: InferenceConfigClassification;
regression?: InferenceConfigRegression;
}

export type InferenceConfigClassification = {
num_top_classes?: number;
num_top_feature_importance_values?: number;
prediction_field_type?: string;
results_field?: Common.Field;
top_classes_results_field?: Common.Field;
}

export type InferenceConfigRegression = {
num_top_feature_importance_values?: number;
results_field?: Common.Field;
}

export type InferenceProcessor = ProcessorBase & {
field_map?: Record<string, Record<string, any>>;
inference_config?: InferenceConfig;
model_id: Common.Id;
target_field?: Common.Field;
}

export type JoinProcessor = ProcessorBase & {
field: Common.Field;
separator: string;
Expand Down Expand Up @@ -236,13 +201,11 @@ export type ProcessorContainer = {
dissect?: DissectProcessor;
dot_expander?: DotExpanderProcessor;
drop?: DropProcessor;
enrich?: EnrichProcessor;
fail?: FailProcessor;
foreach?: ForeachProcessor;
geoip?: GeoIpProcessor;
grok?: GrokProcessor;
gsub?: GsubProcessor;
inference?: InferenceProcessor;
join?: JoinProcessor;
json?: JsonProcessor;
kv?: KeyValueProcessor;
Expand Down Expand Up @@ -287,7 +250,7 @@ export type SetSecurityUserProcessor = ProcessorBase & {
properties?: string[];
}

export type ShapeType = 'geo_shape' | 'shape'
export type ShapeType = 'geo_shape' | 'xy_shape'

export type SortProcessor = ProcessorBase & {
field: Common.Field;
Expand All @@ -304,7 +267,7 @@ export type SplitProcessor = ProcessorBase & {
}

export type TextEmbeddingProcessor = ProcessorBase & {
description?: string;
batch_size?: number;
field_map: Record<string, string>;
model_id: Common.Id;
}
Expand Down
83 changes: 81 additions & 2 deletions api/_types/ml._common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export type Action = {
url?: string;
}

export type AdditionalInfo = Record<string, any>

export type Algorithm = {
value?: 'AD_LIBSVM' | 'AGENT' | 'ANOMALY_LOCALIZATION' | 'BATCH_RCF' | 'CONNECTOR' | 'FIT_RCF' | 'KMEANS' | 'LINEAR_REGRESSION' | 'LOCAL_SAMPLE_CALCULATOR' | 'LOGISTIC_REGRESSION' | 'METRICS_CORRELATION' | 'QUESTION_ANSWERING' | 'RCF_SUMMARIZE' | 'REMOTE' | 'SAMPLE_ALGO' | 'SPARSE_ENCODING' | 'SPARSE_TOKENIZE' | 'TEXT_EMBEDDING' | 'TEXT_SIMILARITY';
}
Expand Down Expand Up @@ -88,6 +90,19 @@ export type GetConnectorResponse = {
version?: Common.VersionString;
}

export type GetMemoryResponse = Memory | {
memories?: Memory[];
next_token?: number;
}

export type GetMessageResponse = Message | {
messages?: Message[];
}

export type GetMessageTracesResponse = {
traces?: Message[];
}

export type Headers = {
content_type?: string;
[key: string]: any;
Expand Down Expand Up @@ -122,12 +137,32 @@ export type LLM = {

export type Match = {
description?: string;
[key: string]: any;
}

export type MatchAllQuery = Record<string, any>

export type Memory = {
additional_info?: AdditionalInfo;
create_time?: string;
memory_id?: Common.Name;
name?: Common.Name;
type?: string;
updated_time?: string;
user?: string;
}

export type Message = {
additional_info?: AdditionalInfo;
create_time?: string;
input?: undefined | string;
memory_id?: Common.Name;
message_id?: Common.Name;
origin?: undefined | string;
parent_message_id?: undefined | string;
prompt_template?: undefined | string;
response?: undefined | string;
trace_number?: number;
}

export type ModelConfig = {
Expand Down Expand Up @@ -196,6 +231,7 @@ export type PredictResponse = {

export type Query = {
bool?: BoolQuery;
match?: Match;
match_all?: MatchAllQuery;
term?: Term;
}
Expand All @@ -214,7 +250,7 @@ export type SearchConnectorsResponse = SearchResponse

export type SearchHits = {
hits: SearchHitsHit[];
max_score?: number;
max_score?: undefined | number;
total: HitsTotal;
}

Expand All @@ -227,8 +263,13 @@ export type SearchHitsHit = {
_source?: Source;
_version?: Common.VersionNumber;
model_id?: Common.Name;
sort?: number[];
}

export type SearchMemoryResponse = SearchResponse

export type SearchMessageResponse = SearchResponse

export type SearchModelGroupsResponse = SearchResponse

export type SearchModelsResponse = SearchResponse
Expand Down Expand Up @@ -265,27 +306,57 @@ export type Sort = {
total_chunks?: SortOrder;
}

export type SortMemory = {
_id?: SortOrder;
_index?: SortOrder;
_score?: SortOrder;
_seq_no?: SortOrder;
additional_info?: SortOrder;
application_time?: SortOrder;
create_time?: SortOrder;
updated_time?: SortOrder;
user?: SortOrder;
}

export type SortMessage = {
_id?: SortOrder;
_index?: SortOrder;
_score?: SortOrder;
_seq_no?: SortOrder;
additional_info?: SortOrder;
create_time?: SortOrder;
memory_id?: SortOrder;
origin?: SortOrder;
parent_message_id?: SortOrder;
trace_number?: SortOrder;
}

export type SortOrder = {
order?: 'asc' | 'desc';
}

export type Source = {
access?: 'private' | 'public' | 'restricted';
actions?: Action[];
additional_info?: AdditionalInfo;
algorithm?: string;
application_type?: undefined | string;
auto_redeploy_retry_times?: number;
backend_roles?: string[];
chunk_number?: number;
connector_id?: string;
create_time?: string;
created_time?: number;
current_worker_node_count?: number;
deploy_to_all_nodes?: boolean;
description?: string;
input?: undefined | string;
is_hidden?: boolean;
last_deployed_time?: number;
last_registered_time?: number;
last_updated_time?: number;
latest_version?: number;
memory_id?: Common.Name;
model_config?: ModelConfig;
model_content_hash_value?: string;
model_content_size_in_bytes?: number;
Expand All @@ -295,14 +366,21 @@ export type Source = {
model_state?: 'DEPLOYED' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'PARTIALLY_DEPLOYED' | 'REGISTERED' | 'REGISTERING' | 'UNDEPLOYED';
model_task_type?: string;
model_version?: string;
name?: string;
name?: Common.Name;
origin?: undefined | string;
owner?: Owner;
parameters?: Parameters;
parent_message_id?: undefined | string;
planning_worker_node_count?: number;
planning_worker_nodes?: Common.NodeIds[];
prompt_template?: undefined | string;
protocol?: 'aws_sigv4' | 'http';
response?: undefined | string;
total_chunks?: number;
trace_number?: undefined | string;
updated_time?: string;
url?: string;
user?: string;
version?: Common.VersionString;
}

Expand All @@ -325,6 +403,7 @@ export type Term = {
_id?: Common.Id[];
algorithm?: Algorithm;
model_id?: Common.Name;
name?: OwnerNameKeyword;
'owner.name.keyword'?: OwnerNameKeyword;
}

Expand Down
Loading
Loading