@sebspark/opensearch 0.3.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -71
- package/dist/index.d.mts +484 -263
- package/dist/index.d.ts +484 -263
- package/dist/index.js +45 -193
- package/dist/index.mjs +37 -179
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,289 +1,510 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bulk_Request, Bulk_ResponseBody, Search_Request, Search_RequestBody, Search_Response, Search_ResponseBody, Index_Request, Index_Response, Indices_Exists_Request, Indices_Exists_Response } from '@opensearch-project/opensearch/api';
|
|
2
|
+
import { Common_Mapping, Core_Bulk, Common as Common$1, Common_QueryDsl } from '@opensearch-project/opensearch/api/_types';
|
|
3
|
+
import { Indices_Create_Request, Indices_Create_RequestBody } from '@opensearch-project/opensearch/api/';
|
|
4
|
+
import OpenSearchAPI from '@opensearch-project/opensearch/api/OpenSearchApi';
|
|
5
|
+
import * as Common from '@opensearch-project/opensearch/api/_types/_common';
|
|
6
|
+
import * as CoreSearch from '@opensearch-project/opensearch/api/_types/_core.search';
|
|
7
|
+
import { Client } from '@opensearch-project/opensearch';
|
|
8
|
+
import { TransportRequestOptions, TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport';
|
|
2
9
|
|
|
3
10
|
type DeepPartial<T> = {
|
|
4
|
-
[P in keyof T]?: T[P] extends
|
|
11
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
5
12
|
};
|
|
6
|
-
type
|
|
7
|
-
[
|
|
8
|
-
};
|
|
9
|
-
type
|
|
10
|
-
[K in keyof T
|
|
11
|
-
}[keyof T] : never;
|
|
12
|
-
type NestedStringPaths<T, Prefix extends string = ''> = T extends object ? {
|
|
13
|
-
[K in keyof T & string]: NestedStringPaths<T[K], `${Prefix}${Prefix extends '' ? '' : '.'}${K}`>;
|
|
13
|
+
type NestedPaths<T, Prefix extends string = ''> = T extends object ? {
|
|
14
|
+
[K in keyof T & string]: `${Prefix}${Prefix extends '' ? '' : '.'}${K}` | NestedPaths<T[K], `${Prefix}${Prefix extends '' ? '' : '.'}${K}`>;
|
|
15
|
+
}[keyof T & string] : never;
|
|
16
|
+
type NestedLeafPaths<T, Prefix extends string = ''> = T extends object ? {
|
|
17
|
+
[K in keyof T & string]: NestedLeafPaths<T[K], `${Prefix}${Prefix extends '' ? '' : '.'}${K}`>;
|
|
14
18
|
}[keyof T & string] : Prefix;
|
|
15
|
-
type
|
|
16
|
-
[K in keyof T]: T[K] extends number ? K : T[K] extends object ? `${K & string}.${NestedNumberPaths<T[K]> & string}` : never;
|
|
17
|
-
}[keyof T] : never;
|
|
18
|
-
type WithId = {
|
|
19
|
-
id: string;
|
|
20
|
-
};
|
|
21
|
-
type ExcludeId<T> = Omit<T, 'id'>;
|
|
22
|
-
type SubstringOf<T extends string> = T extends `${infer Prefix}${infer _Rest}` ? Prefix | SubstringOf<Exclude<T, Prefix>> : never;
|
|
23
|
-
type NotUndefined<T> = T extends undefined ? never : T;
|
|
19
|
+
type Primitive = string | number | boolean;
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Defines all possible field value types in OpenSearch.
|
|
23
|
+
*/
|
|
24
|
+
type FieldValue = Common.FieldValue;
|
|
25
|
+
/**
|
|
26
|
+
* Defines an OpenSearch field with optional properties.
|
|
27
|
+
*/
|
|
28
|
+
type Property = Common_Mapping.Property;
|
|
29
|
+
/**
|
|
30
|
+
* Defines an OpenSearch index mapping.
|
|
31
|
+
*/
|
|
32
|
+
type TypeMapping = Omit<Common_Mapping.TypeMapping, 'properties'> & {
|
|
33
|
+
properties: Record<string, Property>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Defines an OpenSearch index mapping configuration.
|
|
37
|
+
*/
|
|
38
|
+
type IndicesCreateRequestBody = Omit<Indices_Create_RequestBody, 'mappings'> & {
|
|
39
|
+
mappings: TypeMapping;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Defines an OpenSearch index with body required.
|
|
43
|
+
*/
|
|
44
|
+
type IndexDefinition = Omit<Indices_Create_Request, 'body'> & {
|
|
45
|
+
body: IndicesCreateRequestBody;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Converts OpenSearch field definitions into TypeScript types.
|
|
49
|
+
*/
|
|
50
|
+
type MapOpenSearchTypes<T> = T extends Property ? T['type'] extends 'keyword' | 'text' ? string : T['type'] extends 'integer' | 'long' | 'short' | 'byte' | 'float' | 'double' ? number : T['type'] extends 'boolean' ? boolean : T['type'] extends 'date' | 'date_nanos' ? Date : T['type'] extends 'object' | 'nested' ? T extends {
|
|
51
|
+
properties: Record<string, Property>;
|
|
52
|
+
} ? {
|
|
53
|
+
[K in keyof T['properties']]: MapOpenSearchTypes<T['properties'][K]>;
|
|
54
|
+
} : never : never : T extends Record<string, Property> ? {
|
|
55
|
+
[K in keyof T]: MapOpenSearchTypes<T[K]>;
|
|
47
56
|
} : never;
|
|
48
|
-
type
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
type Terms<T> = TermsProperty<T> & {
|
|
55
|
-
boost?: number;
|
|
56
|
-
};
|
|
57
|
-
type Range<T> = {
|
|
58
|
-
[P in NestedNumberPaths<T>]: {
|
|
59
|
-
gte?: number;
|
|
60
|
-
lte?: number;
|
|
61
|
-
gt?: number;
|
|
62
|
-
lt?: number;
|
|
63
|
-
boost?: number;
|
|
57
|
+
type MapQueryProperties<T extends IndexDefinition> = T extends {
|
|
58
|
+
body: {
|
|
59
|
+
mappings: {
|
|
60
|
+
properties: infer P;
|
|
61
|
+
};
|
|
64
62
|
};
|
|
63
|
+
} ? MapOpenSearchTypes<P> : never;
|
|
64
|
+
type Indices = OpenSearchAPI['indices'];
|
|
65
|
+
type Sort<T> = SortOptions<T> | SortOptions<T>[];
|
|
66
|
+
type SortOptions<T> = '_score' | '_doc' | {
|
|
67
|
+
_doc?: Common.ScoreSort;
|
|
68
|
+
_geo_distance?: Common.GeoDistanceSort;
|
|
69
|
+
_score?: Common.ScoreSort;
|
|
70
|
+
_script?: Common.ScriptSort;
|
|
71
|
+
} | Record<NestedPaths<T>, Common.FieldSort>;
|
|
72
|
+
type BuiltinKeys = '_id' | '_index';
|
|
73
|
+
|
|
74
|
+
type DocumentFor<T extends IndexDefinition> = {
|
|
75
|
+
[P in keyof T['body']['mappings']['properties']]: MapOpenSearchTypes<T['body']['mappings']['properties'][P]>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type CreateOperation<T extends IndexDefinition> = Omit<WriteOperation<T>, '_id'> & {
|
|
79
|
+
_id: Common$1.Id;
|
|
80
|
+
};
|
|
81
|
+
type DeleteOperation<T extends IndexDefinition> = OperationBase<T>;
|
|
82
|
+
type IndexOperation<T extends IndexDefinition> = WriteOperation<T>;
|
|
83
|
+
type UpdateOperation<T extends IndexDefinition> = Omit<Core_Bulk.UpdateOperation, '_index' | '_id'> & {
|
|
84
|
+
_id: Common$1.Id;
|
|
85
|
+
_index?: T['index'];
|
|
86
|
+
};
|
|
87
|
+
type WriteOperation<T extends IndexDefinition> = Omit<Core_Bulk.WriteOperation, '_index'> & {
|
|
88
|
+
_index?: T['index'];
|
|
89
|
+
};
|
|
90
|
+
type OperationBase<T extends IndexDefinition> = Omit<Core_Bulk.OperationBase, '_index'> & {
|
|
91
|
+
_index?: T['index'];
|
|
92
|
+
};
|
|
93
|
+
type OperationContainer<T extends IndexDefinition> = {
|
|
94
|
+
create?: CreateOperation<T>;
|
|
95
|
+
delete?: DeleteOperation<T>;
|
|
96
|
+
index?: IndexOperation<T>;
|
|
97
|
+
update?: UpdateOperation<T>;
|
|
98
|
+
};
|
|
99
|
+
type UpdateAction<T extends IndexDefinition> = Omit<Core_Bulk.UpdateAction, 'doc' | 'upsert'> & ({
|
|
100
|
+
doc: DeepPartial<DocumentFor<T>>;
|
|
101
|
+
upsert?: DocumentFor<T>;
|
|
102
|
+
} | {
|
|
103
|
+
doc?: DeepPartial<DocumentFor<T>>;
|
|
104
|
+
upsert: DocumentFor<T>;
|
|
105
|
+
});
|
|
106
|
+
type BulkRequest<T extends IndexDefinition> = Omit<Bulk_Request, 'index' | 'body' | '_source_excludes' | '_source_includes'> & {
|
|
107
|
+
index: T['index'];
|
|
108
|
+
body: BulkRequestBody<T>;
|
|
109
|
+
_source_excludes?: NestedLeafPaths<T> | Common$1.Fields;
|
|
110
|
+
_source_includes?: NestedLeafPaths<T> | Common$1.Fields;
|
|
111
|
+
};
|
|
112
|
+
type BulkRequestBody<T extends IndexDefinition> = (OperationContainer<T> | UpdateAction<T> | DocumentFor<T>)[];
|
|
113
|
+
type ResponseItem<T extends IndexDefinition> = Omit<Core_Bulk.ResponseItem, '_index'> & {
|
|
114
|
+
_index: T['index'];
|
|
65
115
|
};
|
|
66
|
-
type
|
|
116
|
+
type CustomOperation = string;
|
|
117
|
+
type BulkOperation = 'index' | 'update' | 'delete' | 'create' | CustomOperation;
|
|
118
|
+
type BulkResponseBody<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'items'> & {
|
|
119
|
+
items: Record<BulkOperation, ResponseItem<T>>[];
|
|
120
|
+
};
|
|
121
|
+
type BulkResponse<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'body'> & {
|
|
122
|
+
body: BulkResponseBody<T>;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
type BoolQuery<T> = Omit<Common_QueryDsl.BoolQuery, 'must' | 'should' | 'filter' | 'must_not'> & {
|
|
126
|
+
must?: QueryContainer<T>[];
|
|
127
|
+
should?: QueryContainer<T>[];
|
|
128
|
+
filter?: QueryContainer<T>[];
|
|
129
|
+
must_not?: QueryContainer<T>[];
|
|
130
|
+
};
|
|
131
|
+
type BoostingQuery<T> = Omit<Common_QueryDsl.BoostingQuery, 'positive' | 'negative'> & {
|
|
132
|
+
positive: QueryContainer<T>;
|
|
133
|
+
negative: QueryContainer<T>;
|
|
134
|
+
};
|
|
135
|
+
type CombinedFieldsQuery<T> = Omit<Common_QueryDsl.CombinedFieldsQuery, 'fields'> & {
|
|
136
|
+
fields: NestedPaths<T>[];
|
|
137
|
+
};
|
|
138
|
+
type CommonTermsQuery = Common_QueryDsl.CommonTermsQuery;
|
|
139
|
+
type ConstantScoreQuery<T> = Omit<Common_QueryDsl.ConstantScoreQuery, 'filter'> & {
|
|
140
|
+
filter: QueryContainer<T>;
|
|
141
|
+
};
|
|
142
|
+
type DateDecayFunction = Common_QueryDsl.DateDecayFunction;
|
|
143
|
+
type DateDistanceFeatureQuery = Common_QueryDsl.DateDistanceFeatureQuery;
|
|
144
|
+
type DateRangeQuery = Common_QueryDsl.DateRangeQuery;
|
|
145
|
+
type DecayFunction = Common_QueryDsl.DecayFunction;
|
|
146
|
+
type DecayFunctionBase = Common_QueryDsl.DecayFunctionBase;
|
|
147
|
+
type DisMaxQuery<T> = Omit<Common_QueryDsl.DisMaxQuery, 'queries'> & {
|
|
148
|
+
queries: QueryContainer<T>[];
|
|
149
|
+
};
|
|
150
|
+
type DistanceFeatureQuery<T> = Omit<Common_QueryDsl.DistanceFeatureQuery, 'field'> & {
|
|
67
151
|
field: NestedPaths<T>;
|
|
68
152
|
};
|
|
69
|
-
type
|
|
70
|
-
|
|
71
|
-
value: string;
|
|
72
|
-
flags?: string;
|
|
73
|
-
max_determinized_states?: number;
|
|
74
|
-
boost?: number;
|
|
75
|
-
};
|
|
153
|
+
type ExistsQuery<T> = Omit<Common_QueryDsl.ExistsQuery, 'field'> & {
|
|
154
|
+
field: NestedPaths<T>;
|
|
76
155
|
};
|
|
77
|
-
type
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
type
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
type
|
|
89
|
-
type
|
|
156
|
+
type FieldAndFormat<T> = Omit<Common_QueryDsl.FieldAndFormat, 'field'> & {
|
|
157
|
+
field: NestedPaths<T>;
|
|
158
|
+
};
|
|
159
|
+
type FieldQuery<T, K> = Partial<Record<NestedLeafPaths<T> | BuiltinKeys, K>>;
|
|
160
|
+
type FieldValueFactorScoreFunction<T> = Omit<Common_QueryDsl.FieldValueFactorScoreFunction, 'field'> & {
|
|
161
|
+
field: NestedPaths<T>;
|
|
162
|
+
};
|
|
163
|
+
type FunctionBoostMode = Common_QueryDsl.FunctionBoostMode;
|
|
164
|
+
type FunctionScoreQuery<T> = Omit<Common_QueryDsl.FunctionScoreQuery, 'query'> & {
|
|
165
|
+
query?: QueryContainer<T> | undefined;
|
|
166
|
+
};
|
|
167
|
+
type FuzzyQuery = Common_QueryDsl.FuzzyQuery;
|
|
168
|
+
type GeoBoundingBoxQuery = Common_QueryDsl.GeoBoundingBoxQuery;
|
|
169
|
+
type GeoDecayFunction = Common_QueryDsl.GeoDecayFunction;
|
|
170
|
+
type GeoDistanceFeatureQuery = Common_QueryDsl.GeoDistanceFeatureQuery;
|
|
171
|
+
type GeoDistanceQuery = Common_QueryDsl.GeoDistanceQuery;
|
|
172
|
+
type GeoExecution = Common_QueryDsl.GeoExecution;
|
|
173
|
+
type GeoPolygonQuery<T> = Omit<Common_QueryDsl.GeoPolygonQuery, 'field'> & {
|
|
174
|
+
field: NestedPaths<T>;
|
|
175
|
+
};
|
|
176
|
+
type GeoShapeQuery<T> = Omit<Common_QueryDsl.GeoShapeQuery, 'ignore_unmapped' | 'field'> & {
|
|
177
|
+
field: NestedPaths<T>;
|
|
178
|
+
};
|
|
179
|
+
type GeoValidationMethod = Common_QueryDsl.GeoValidationMethod;
|
|
180
|
+
type HasChildQuery<T> = Omit<Common_QueryDsl.HasChildQuery, 'query'> & {
|
|
181
|
+
query: QueryContainer<T>;
|
|
182
|
+
};
|
|
183
|
+
type HasParentQuery<T> = Omit<Common_QueryDsl.HasParentQuery, 'query'> & {
|
|
184
|
+
query: QueryContainer<T>;
|
|
185
|
+
};
|
|
186
|
+
type HybridQuery<T> = Omit<Common_QueryDsl.HybridQuery, 'queries'> & {
|
|
187
|
+
queries?: QueryContainer<T>[];
|
|
188
|
+
};
|
|
189
|
+
type IdsQuery = Common_QueryDsl.IdsQuery;
|
|
190
|
+
type IntervalsQuery = Common_QueryDsl.IntervalsQuery;
|
|
191
|
+
type KnnQuery<T> = Omit<Common_QueryDsl.KnnQuery, 'filter'> & {
|
|
192
|
+
filter?: QueryContainer<T>[];
|
|
193
|
+
};
|
|
194
|
+
type Like = Common_QueryDsl.Like;
|
|
195
|
+
type LikeDocument = Common_QueryDsl.LikeDocument;
|
|
196
|
+
type MatchAllQuery = Common_QueryDsl.MatchAllQuery;
|
|
197
|
+
type MatchBoolPrefixQuery<T> = Omit<Common_QueryDsl.MatchBoolPrefixQuery, 'query' | 'fields'> & {
|
|
198
|
+
fields: NestedPaths<T>[];
|
|
90
199
|
query: string;
|
|
91
|
-
fields: MultiMatchParam<NestedStringPaths<T>>[];
|
|
92
|
-
type?: 'best_fields' | 'most_fields' | 'cross_fields' | 'phrase' | 'phrase_prefix';
|
|
93
|
-
operator?: 'and' | 'or';
|
|
94
200
|
};
|
|
95
|
-
type
|
|
201
|
+
type MatchNoneQuery = Common_QueryDsl.MatchNoneQuery;
|
|
202
|
+
type MatchPhrasePrefixQuery<T> = Omit<Common_QueryDsl.MatchPhrasePrefixQuery, 'query' | 'field'> & {
|
|
203
|
+
field: NestedPaths<T>;
|
|
96
204
|
query: string;
|
|
97
|
-
fields?: Array<keyof NestedFields<T>>;
|
|
98
|
-
};
|
|
99
|
-
type FilterQueryString<T> = SimpleFilterQueryString<T> & {
|
|
100
|
-
default_field?: keyof NestedFields<T>;
|
|
101
|
-
};
|
|
102
|
-
type FilterBool<T> = {
|
|
103
|
-
must?: OpenSearchFilter<T> | OpenSearchFilter<T>[];
|
|
104
|
-
filter?: OpenSearchFilter<T> | OpenSearchFilter<T>[];
|
|
105
|
-
should?: OpenSearchFilter<T> | OpenSearchFilter<T>[];
|
|
106
|
-
must_not?: OpenSearchFilter<T> | OpenSearchFilter<T>[];
|
|
107
|
-
minimum_should_match?: number;
|
|
108
|
-
boost?: number;
|
|
109
|
-
};
|
|
110
|
-
type OpenSearchFilter<T> = {
|
|
111
|
-
term?: Term<T>;
|
|
112
|
-
terms?: Terms<T>;
|
|
113
|
-
range?: Range<T>;
|
|
114
|
-
exists?: Exists<T>;
|
|
115
|
-
fuzzy?: Fuzzy<T>;
|
|
116
|
-
prefix?: Partial<NestedFields<T>>;
|
|
117
|
-
wildcard?: Wildcard<T>;
|
|
118
|
-
regexp?: Regexp<T>;
|
|
119
|
-
match?: Match<T>;
|
|
120
|
-
match_phrase?: Partial<NestedFields<T>>;
|
|
121
|
-
match_phrase_prefix?: Partial<NestedFields<T>>;
|
|
122
|
-
multi_match?: MultiMatch<T>;
|
|
123
|
-
query_string?: FilterQueryString<T>;
|
|
124
|
-
simple_query_string?: SimpleFilterQueryString<T>;
|
|
125
|
-
bool?: FilterBool<T>;
|
|
126
|
-
};
|
|
127
|
-
type Collapse<T> = {
|
|
128
|
-
field: keyof NestedFields<T>;
|
|
129
|
-
};
|
|
130
|
-
type ScriptScore = {
|
|
131
|
-
script: {
|
|
132
|
-
source: string;
|
|
133
|
-
params?: {
|
|
134
|
-
[key: string]: any;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
205
|
};
|
|
138
|
-
type
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
};
|
|
206
|
+
type MatchPhraseQuery<T> = Omit<Common_QueryDsl.MatchPhraseQuery, 'query' | 'field'> & {
|
|
207
|
+
field: NestedPaths<T>;
|
|
208
|
+
query: string;
|
|
142
209
|
};
|
|
143
|
-
type
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
boost?: number;
|
|
147
|
-
};
|
|
210
|
+
type MatchQuery = FieldValue | Common_QueryDsl.MatchQuery;
|
|
211
|
+
type MoreLikeThisQuery<T> = Omit<Common_QueryDsl.MoreLikeThisQuery, 'fields'> & {
|
|
212
|
+
fields?: NestedPaths<T>[];
|
|
148
213
|
};
|
|
149
|
-
type
|
|
150
|
-
|
|
151
|
-
value: string;
|
|
152
|
-
boost?: number;
|
|
153
|
-
};
|
|
214
|
+
type MultiMatchQuery<T> = Omit<Common_QueryDsl.MultiMatchQuery, 'fields'> & {
|
|
215
|
+
fields?: NestedPaths<T>[];
|
|
154
216
|
};
|
|
155
|
-
type
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
analyzer?: string;
|
|
159
|
-
slop?: number;
|
|
160
|
-
boost?: number;
|
|
161
|
-
};
|
|
217
|
+
type NestedQuery<T> = Omit<Common_QueryDsl.NestedQuery, 'query' | 'path'> & {
|
|
218
|
+
path: NestedPaths<T>;
|
|
219
|
+
query: QueryContainer<T>;
|
|
162
220
|
};
|
|
163
|
-
type
|
|
164
|
-
|
|
165
|
-
query: NestedFields<T>[P];
|
|
166
|
-
max_expansions?: number;
|
|
167
|
-
slop?: number;
|
|
168
|
-
boost?: number;
|
|
169
|
-
};
|
|
221
|
+
type NeuralQuery<T> = Omit<Common_QueryDsl.NeuralQuery, 'filter'> & {
|
|
222
|
+
filter?: QueryContainer<T>;
|
|
170
223
|
};
|
|
171
|
-
type
|
|
172
|
-
|
|
173
|
-
like: string | string[] | {
|
|
174
|
-
_index: string;
|
|
175
|
-
_id: string;
|
|
176
|
-
}[];
|
|
177
|
-
unlike?: string | string[] | {
|
|
178
|
-
_index: string;
|
|
179
|
-
_id: string;
|
|
180
|
-
}[];
|
|
181
|
-
min_term_freq?: number;
|
|
182
|
-
max_query_terms?: number;
|
|
183
|
-
min_doc_freq?: number;
|
|
184
|
-
max_doc_freq?: number;
|
|
185
|
-
min_word_length?: number;
|
|
186
|
-
max_word_length?: number;
|
|
187
|
-
stop_words?: string[];
|
|
188
|
-
analyzer?: string;
|
|
189
|
-
minimum_should_match?: number;
|
|
190
|
-
boost?: number;
|
|
191
|
-
include?: boolean;
|
|
192
|
-
fail_on_unsupported_field?: boolean;
|
|
193
|
-
};
|
|
194
|
-
type OpenSearchQueryBody<T extends {
|
|
195
|
-
id: string;
|
|
196
|
-
}, K = T> = K extends DeepPartial<T> ? {
|
|
197
|
-
query: {
|
|
198
|
-
ids?: {
|
|
199
|
-
values: string[];
|
|
200
|
-
};
|
|
201
|
-
filter?: OpenSearchFilter<T>;
|
|
202
|
-
match?: Match<T>;
|
|
203
|
-
match_all?: {
|
|
204
|
-
boost?: number;
|
|
205
|
-
};
|
|
206
|
-
multi_match?: MultiMatch<T>;
|
|
207
|
-
from?: number;
|
|
208
|
-
size?: number;
|
|
209
|
-
collapse?: Collapse<K>;
|
|
210
|
-
script_score?: ScriptScore;
|
|
211
|
-
highlight?: Highlight<K>;
|
|
212
|
-
bool?: FilterBool<T>;
|
|
213
|
-
range?: Range<T>;
|
|
214
|
-
exists?: Exists<T>;
|
|
215
|
-
terms?: Terms<T>;
|
|
216
|
-
term?: Term<T>;
|
|
217
|
-
fuzzy?: Fuzzy<T>;
|
|
218
|
-
prefix?: Prefix<T>;
|
|
219
|
-
wildcard?: Wildcard<T>;
|
|
220
|
-
regexp?: Regexp<T>;
|
|
221
|
-
match_phrase?: MatchPhrase<T>;
|
|
222
|
-
match_phrase_prefix?: MatchPhrasePrefix<T>;
|
|
223
|
-
more_like_this?: MoreLikeThis<T>;
|
|
224
|
-
};
|
|
225
|
-
sort?: Sort<T>[];
|
|
226
|
-
from?: number;
|
|
227
|
-
size?: number;
|
|
228
|
-
_source?: OpenSearchFields<K>;
|
|
229
|
-
} : never;
|
|
230
|
-
type Order = 'asc' | 'desc';
|
|
231
|
-
type Mode = 'min' | 'max' | 'sum' | 'avg' | 'median';
|
|
232
|
-
type Missing = '_first' | '_last' | 'custom_value';
|
|
233
|
-
type Sort<T> = {
|
|
234
|
-
[P in NestedPaths<T>]?: Order | {
|
|
235
|
-
order?: Order;
|
|
236
|
-
mode?: Mode;
|
|
237
|
-
missing?: Missing;
|
|
238
|
-
unmapped_type?: BasicOpenSearchFieldTypes;
|
|
239
|
-
numeric_type?: NumberTypes;
|
|
240
|
-
format?: string;
|
|
241
|
-
};
|
|
224
|
+
type NumberRangeQuery<T> = Omit<Common_QueryDsl.NumberRangeQuery, 'field'> & {
|
|
225
|
+
field: NestedPaths<T>;
|
|
242
226
|
};
|
|
243
|
-
type
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
type
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
227
|
+
type ParentIdQuery = Common_QueryDsl.ParentIdQuery;
|
|
228
|
+
type PercolateQuery<T> = Omit<Common_QueryDsl.PercolateQuery, 'field'> & {
|
|
229
|
+
field: NestedPaths<T>;
|
|
230
|
+
};
|
|
231
|
+
type PinnedQuery = Common_QueryDsl.PinnedQuery;
|
|
232
|
+
type PrefixQuery<T> = Omit<Common_QueryDsl.PrefixQuery, 'value' | 'field'> & {
|
|
233
|
+
field: NestedPaths<T>;
|
|
234
|
+
value: MapOpenSearchTypes<T>;
|
|
235
|
+
};
|
|
236
|
+
type QueryContainer<T> = Omit<Common_QueryDsl.QueryContainer, 'bool' | 'boosting' | 'combined_fields' | 'common' | 'constant_score' | 'dis_max' | 'distance_feature' | 'exists' | 'function_score' | 'fuzzy' | 'geo_bounding_box' | 'geo_distance' | 'geo_polygon' | 'geo_shape' | 'has_child' | 'has_parent' | 'hybrid' | 'ids' | 'intervals' | 'knn' | 'match' | 'match_all' | 'match_bool_prefix' | 'match_none' | 'match_phrase' | 'match_phrase_prefix' | 'more_like_this' | 'multi_match' | 'nested' | 'neural' | 'parent_id' | 'percolate' | 'pinned' | 'prefix' | 'query_string' | 'range' | 'rank_feature' | 'regexp' | 'script' | 'script_score' | 'simple_query_string' | 'span_containing' | 'span_first' | 'span_multi' | 'span_near' | 'span_not' | 'span_or' | 'span_term' | 'span_within' | 'term' | 'terms' | 'terms_set' | 'type' | 'wildcard' | 'wrapper' | 'xy_shape'> & {
|
|
237
|
+
bool?: BoolQuery<T>;
|
|
238
|
+
boosting?: BoostingQuery<T>;
|
|
239
|
+
combined_fields?: CombinedFieldsQuery<T>;
|
|
240
|
+
common?: FieldQuery<T, Common_QueryDsl.CommonTermsQuery>;
|
|
241
|
+
constant_score?: ConstantScoreQuery<T>;
|
|
242
|
+
dis_max?: DisMaxQuery<T>;
|
|
243
|
+
distance_feature?: DistanceFeatureQuery<T>;
|
|
244
|
+
exists?: ExistsQuery<T>;
|
|
245
|
+
function_score?: FunctionScoreQuery<T>;
|
|
246
|
+
fuzzy?: FieldQuery<T, Common_QueryDsl.FuzzyQuery>;
|
|
247
|
+
geo_bounding_box?: GeoBoundingBoxQuery;
|
|
248
|
+
geo_distance?: GeoDistanceQuery;
|
|
249
|
+
geo_polygon?: GeoPolygonQuery<T>;
|
|
250
|
+
geo_shape?: GeoShapeQuery<T>;
|
|
251
|
+
has_child?: HasChildQuery<T>;
|
|
252
|
+
has_parent?: HasParentQuery<T>;
|
|
253
|
+
hybrid?: HybridQuery<T>;
|
|
254
|
+
ids?: IdsQuery;
|
|
255
|
+
intervals?: FieldQuery<T, IntervalsQuery>;
|
|
256
|
+
knn?: FieldQuery<T, KnnQuery<T>>;
|
|
257
|
+
match?: FieldQuery<T, MatchQuery>;
|
|
258
|
+
match_all?: MatchAllQuery;
|
|
259
|
+
match_bool_prefix?: FieldQuery<T, MatchBoolPrefixQuery<T>>;
|
|
260
|
+
match_none?: MatchNoneQuery;
|
|
261
|
+
match_phrase?: FieldQuery<T, MatchPhraseQuery<T>>;
|
|
262
|
+
match_phrase_prefix?: FieldQuery<T, MatchPhrasePrefixQuery<T>>;
|
|
263
|
+
more_like_this?: MoreLikeThisQuery<T>;
|
|
264
|
+
multi_match?: MultiMatchQuery<T>;
|
|
265
|
+
nested?: NestedQuery<T>;
|
|
266
|
+
neural?: FieldQuery<T, NeuralQuery<T>>;
|
|
267
|
+
parent_id?: ParentIdQuery;
|
|
268
|
+
percolate?: PercolateQuery<T>;
|
|
269
|
+
pinned?: PinnedQuery;
|
|
270
|
+
prefix?: FieldQuery<T, PrefixQuery<T>>;
|
|
271
|
+
query_string?: QueryStringQuery;
|
|
272
|
+
range?: FieldQuery<T, RangeQuery<T>>;
|
|
273
|
+
rank_feature?: RankFeatureQuery;
|
|
274
|
+
regexp?: FieldQuery<T, RegexpQuery<T>>;
|
|
275
|
+
script?: ScriptQuery;
|
|
276
|
+
script_score?: ScriptScoreQuery<T>;
|
|
277
|
+
simple_query_string?: SimpleQueryStringQuery<T>;
|
|
278
|
+
span_containing?: SpanContainingQuery<T>;
|
|
279
|
+
span_first?: SpanFirstQuery<T>;
|
|
280
|
+
span_multi?: SpanMultiTermQuery<T>;
|
|
281
|
+
span_near?: SpanNearQuery<T>;
|
|
282
|
+
span_not?: SpanNotQuery<T>;
|
|
283
|
+
span_or?: SpanOrQuery<T>;
|
|
284
|
+
span_term?: FieldQuery<T, SpanTermQuery<T>>;
|
|
285
|
+
span_within?: SpanWithinQuery<T>;
|
|
286
|
+
term?: FieldQuery<T, TermQuery<T>>;
|
|
287
|
+
terms?: TermsQuery<T>;
|
|
288
|
+
terms_set?: FieldQuery<T, TermsSetQuery<T>>;
|
|
289
|
+
type?: TypeQuery;
|
|
290
|
+
wildcard?: FieldQuery<T, WildcardQuery<T>>;
|
|
291
|
+
wrapper?: WrapperQuery;
|
|
292
|
+
xy_shape?: XyShapeQuery<T>;
|
|
293
|
+
};
|
|
294
|
+
type QueryStringQuery = Common_QueryDsl.QueryStringQuery;
|
|
295
|
+
type RangeQuery<T> = Omit<Common_QueryDsl.RangeQuery, 'field'> & {
|
|
296
|
+
field: NestedPaths<T>;
|
|
297
|
+
};
|
|
298
|
+
type RankFeatureQuery = Common_QueryDsl.RankFeatureQuery;
|
|
299
|
+
type RegexpQuery<T> = Omit<Common_QueryDsl.RegexpQuery, 'value' | 'field'> & {
|
|
300
|
+
field: NestedPaths<T>;
|
|
301
|
+
value: MapOpenSearchTypes<T>;
|
|
302
|
+
};
|
|
303
|
+
type ScriptQuery = Common_QueryDsl.ScriptQuery;
|
|
304
|
+
type ScriptScoreQuery<T> = Omit<Common_QueryDsl.ScriptScoreQuery, 'query'> & {
|
|
305
|
+
query?: QueryContainer<T>;
|
|
306
|
+
};
|
|
307
|
+
type SimpleQueryStringQuery<T> = Omit<Common_QueryDsl.SimpleQueryStringQuery, 'fields'> & {
|
|
308
|
+
fields: NestedLeafPaths<T>[];
|
|
309
|
+
};
|
|
310
|
+
type SpanQuery<T> = Omit<Common_QueryDsl.SpanQuery, 'field_masking_span' | 'span_containing' | 'span_first' | 'span_multi' | 'span_near' | 'span_not' | 'span_or' | 'span_term' | 'span_within'> & {
|
|
311
|
+
field_masking_span?: SpanFieldMaskingQuery<T>;
|
|
312
|
+
span_containing?: SpanContainingQuery<T>;
|
|
313
|
+
span_first?: SpanFirstQuery<T>;
|
|
314
|
+
span_multi?: SpanMultiTermQuery<T>;
|
|
315
|
+
span_near?: SpanNearQuery<T>;
|
|
316
|
+
span_not?: SpanNotQuery<T>;
|
|
317
|
+
span_or?: SpanOrQuery<T>;
|
|
318
|
+
span_term?: Record<NestedPaths<T>, SpanTermQuery<T>>;
|
|
319
|
+
span_within?: SpanWithinQuery<T>;
|
|
320
|
+
};
|
|
321
|
+
type SpanContainingQuery<T> = Omit<Common_QueryDsl.SpanContainingQuery, 'big' | 'little'> & {
|
|
322
|
+
big: SpanQuery<T>;
|
|
323
|
+
little: SpanQuery<T>;
|
|
324
|
+
};
|
|
325
|
+
type SpanFieldMaskingQuery<T> = Omit<Common_QueryDsl.SpanFieldMaskingQuery, 'field' | 'query'> & {
|
|
326
|
+
field: NestedPaths<T>;
|
|
327
|
+
query: SpanQuery<T>;
|
|
328
|
+
};
|
|
329
|
+
type SpanFirstQuery<T> = Omit<Common_QueryDsl.SpanFirstQuery, 'match'> & {
|
|
330
|
+
match: SpanQuery<T>;
|
|
331
|
+
};
|
|
332
|
+
type SpanMultiTermQuery<T> = Omit<Common_QueryDsl.SpanMultiTermQuery, 'match'> & {
|
|
333
|
+
match: QueryContainer<T>;
|
|
334
|
+
};
|
|
335
|
+
type SpanNearQuery<T> = Omit<Common_QueryDsl.SpanNearQuery, 'clauses'> & {
|
|
336
|
+
clauses: SpanQuery<T>[];
|
|
337
|
+
};
|
|
338
|
+
type SpanNotQuery<T> = Omit<Common_QueryDsl.SpanNotQuery, 'include' | 'exclude'> & {
|
|
339
|
+
include: SpanQuery<T>;
|
|
340
|
+
exclude: SpanQuery<T>;
|
|
341
|
+
};
|
|
342
|
+
type SpanOrQuery<T> = Omit<Common_QueryDsl.SpanOrQuery, 'clauses'> & {
|
|
343
|
+
clauses: SpanQuery<T>[];
|
|
344
|
+
};
|
|
345
|
+
type SpanTermQuery<T> = Omit<Common_QueryDsl.SpanTermQuery, 'value' | 'field'> & {
|
|
346
|
+
field: NestedPaths<T>;
|
|
347
|
+
value: MapOpenSearchTypes<T>;
|
|
348
|
+
};
|
|
349
|
+
type SpanWithinQuery<T> = Omit<Common_QueryDsl.SpanWithinQuery, 'big' | 'little'> & {
|
|
350
|
+
big: SpanQuery<T>;
|
|
351
|
+
little: SpanQuery<T>;
|
|
352
|
+
};
|
|
353
|
+
type TermQuery<T> = Omit<Common_QueryDsl.TermQuery, 'value' | 'field'> & {
|
|
354
|
+
field: NestedPaths<T>;
|
|
355
|
+
value: MapOpenSearchTypes<T>;
|
|
356
|
+
};
|
|
357
|
+
type TermsQuery<T> = Omit<Common_QueryDsl.TermsQuery, 'terms' | 'field'> & {
|
|
358
|
+
field: NestedPaths<T>;
|
|
359
|
+
terms: FieldValue[];
|
|
360
|
+
};
|
|
361
|
+
type TermsSetQuery<T> = Omit<Common_QueryDsl.TermsSetQuery, 'terms' | 'field'> & {
|
|
362
|
+
field: NestedPaths<T>;
|
|
363
|
+
terms: FieldValue[];
|
|
364
|
+
};
|
|
365
|
+
type TypeQuery = Common_QueryDsl.TypeQuery;
|
|
366
|
+
type WildcardQuery<T> = Omit<Common_QueryDsl.WildcardQuery, 'value' | 'field'> & {
|
|
367
|
+
field: NestedPaths<T>;
|
|
368
|
+
value: MapOpenSearchTypes<T>;
|
|
369
|
+
};
|
|
370
|
+
type WrapperQuery = Common_QueryDsl.WrapperQuery;
|
|
371
|
+
type XyShapeQuery<T> = Omit<Common_QueryDsl.XyShapeQuery, 'field'> & {
|
|
372
|
+
field: NestedPaths<T>;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
type FieldCollapse<T> = Omit<CoreSearch.FieldCollapse, 'field'> & {
|
|
376
|
+
field: NestedPaths<T>;
|
|
377
|
+
};
|
|
378
|
+
type Highlight<T> = Omit<CoreSearch.Highlight, 'fields'> & {
|
|
379
|
+
fields: FieldQuery<T, CoreSearch.HighlightField>;
|
|
380
|
+
};
|
|
381
|
+
type Hit<T extends IndexDefinition> = Omit<CoreSearch.Hit, '_source'> & {
|
|
382
|
+
_source: DocumentFor<T>;
|
|
383
|
+
};
|
|
384
|
+
type HitsMetadata<T extends IndexDefinition> = Omit<CoreSearch.HitsMetadata, 'hits'> & {
|
|
385
|
+
hits: Hit<T>[];
|
|
386
|
+
};
|
|
387
|
+
type SourceConfig<T> = boolean | SourceFilter<T>;
|
|
388
|
+
type SourceFilter<T> = NestedPaths<T>[] | {
|
|
389
|
+
excludes?: NestedPaths<T>[];
|
|
390
|
+
includes?: NestedPaths<T>[];
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
type SearchRequest<T extends IndexDefinition> = Omit<Search_Request, 'body' | 'index'> & {
|
|
394
|
+
index: T['index'];
|
|
395
|
+
body: SearchRequestBody<T>;
|
|
396
|
+
};
|
|
397
|
+
type SearchRequestBody<T extends IndexDefinition> = Omit<Search_RequestBody, 'query' | 'collapse' | 'highlight' | 'sort' | '_source'> & {
|
|
398
|
+
query?: QueryContainer<MapQueryProperties<T>>;
|
|
399
|
+
collapse?: FieldCollapse<MapQueryProperties<T>>;
|
|
400
|
+
highlight?: Highlight<MapQueryProperties<T>>;
|
|
401
|
+
sort?: Sort<MapQueryProperties<T>>;
|
|
402
|
+
_source?: SourceConfig<MapQueryProperties<T>>;
|
|
403
|
+
};
|
|
404
|
+
type SearchResponse<T extends IndexDefinition> = Omit<Search_Response, 'body'> & {
|
|
405
|
+
body: SearchResponseBody<T>;
|
|
406
|
+
};
|
|
407
|
+
type SearchResponseBody<T extends IndexDefinition> = Omit<Search_ResponseBody, 'hits'> & {
|
|
408
|
+
hits: HitsMetadata<T>;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
interface IndexRequest<T> extends Omit<Index_Request, 'body' | 'index'> {
|
|
412
|
+
index: T extends {
|
|
413
|
+
index: infer I;
|
|
414
|
+
} ? I : never;
|
|
415
|
+
body: T extends {
|
|
416
|
+
body: {
|
|
417
|
+
mappings: {
|
|
418
|
+
properties: infer P;
|
|
419
|
+
};
|
|
269
420
|
};
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
421
|
+
} ? MapOpenSearchTypes<P> : never;
|
|
422
|
+
}
|
|
423
|
+
interface IndexResponse extends Index_Response {
|
|
424
|
+
}
|
|
425
|
+
type IndicesExistsRequest<T extends IndexDefinition> = Omit<Indices_Exists_Request, 'index'> & {
|
|
426
|
+
index: Extract<T['index'], string>;
|
|
275
427
|
};
|
|
276
428
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
429
|
+
type TypedIndices = Omit<Indices, 'exists'> & {
|
|
430
|
+
exists<T extends IndexDefinition>(params: IndicesExistsRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<Indices_Exists_Response>;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* ✅ Constructor type that ensures `new OpenSearchClient()` works.
|
|
434
|
+
* - This type is necessary because `OpenSearchClient` is actually a function (not a class).
|
|
435
|
+
*/
|
|
436
|
+
type OpenSearchClientConstructor = new (...args: ConstructorParameters<typeof Client>) => OpenSearchClient;
|
|
437
|
+
/**
|
|
438
|
+
* ✅ Custom interface that extends `Client`, but replaces the `search()` method signature.
|
|
439
|
+
* - Uses `Omit<Client, "search">` to remove `search()` from `Client`.
|
|
440
|
+
* - Defines a new `search<T>()` method with stricter type safety.
|
|
441
|
+
*/
|
|
442
|
+
interface OpenSearchClient extends Omit<Client, 'search' | 'index' | 'bulk' | 'indices'> {
|
|
443
|
+
search<T extends IndexDefinition>(params: SearchRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<SearchResponse<T>>;
|
|
444
|
+
index<T extends IndexDefinition>(params: IndexRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<Index_Response>;
|
|
445
|
+
bulk<T extends IndexDefinition>(params: BulkRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<BulkResponse<T>>;
|
|
446
|
+
indices: TypedIndices;
|
|
286
447
|
}
|
|
287
|
-
|
|
448
|
+
/**
|
|
449
|
+
* ✅ A function that behaves like a class constructor.
|
|
450
|
+
* - Instantiates a new `Client` internally.
|
|
451
|
+
* - Casts the instance to `OpenSearchClient` so TypeScript recognizes the new `search<T>()` signature.
|
|
452
|
+
* - The `as unknown as` trick ensures `new OpenSearchClient()` is valid.
|
|
453
|
+
*/
|
|
454
|
+
declare const OpenSearchClient: OpenSearchClientConstructor;
|
|
455
|
+
|
|
456
|
+
type IdFunction<T extends IndexDefinition> = (doc: DocumentFor<T>) => Common$1.Id;
|
|
457
|
+
/**
|
|
458
|
+
* Constructs a bulk request payload for indexing documents.
|
|
459
|
+
*
|
|
460
|
+
* For each document in the provided array, this helper creates a two‑line bulk operation:
|
|
461
|
+
* 1. An action object for an index operation. If an id generator is provided, its result is used as _id.
|
|
462
|
+
* 2. The document itself.
|
|
463
|
+
*
|
|
464
|
+
* @param index - The name of the index.
|
|
465
|
+
* @param docs - An array of documents to insert.
|
|
466
|
+
* @param idFn - Optional function that returns an _id for a given document.
|
|
467
|
+
* @returns A BulkRequest payload for insert operations.
|
|
468
|
+
*/
|
|
469
|
+
declare function bulkIndex<T extends IndexDefinition>(index: T['index'], docs: DocumentFor<T>[], idFn?: IdFunction<T>): BulkRequest<T>;
|
|
470
|
+
/**
|
|
471
|
+
* Constructs a bulk request payload for creating documents.
|
|
472
|
+
*
|
|
473
|
+
* For each document in the provided array, this helper creates a two‑line bulk operation:
|
|
474
|
+
* 1. An action object for a create operation with a generated _id.
|
|
475
|
+
* 2. The document itself.
|
|
476
|
+
*
|
|
477
|
+
* @param index - The name of the index.
|
|
478
|
+
* @param docs - An array of documents to create.
|
|
479
|
+
* @param idFn - A function that returns a unique _id for each document.
|
|
480
|
+
* @returns A BulkRequest payload for create operations.
|
|
481
|
+
*/
|
|
482
|
+
declare function bulkCreate<T extends IndexDefinition>(index: T['index'], docs: DocumentFor<T>[], idFn: IdFunction<T>): BulkRequest<T>;
|
|
483
|
+
/**
|
|
484
|
+
* Constructs a bulk request payload for update operations.
|
|
485
|
+
*
|
|
486
|
+
* This helper takes an array of update actions (of type UpdateAction<T>),
|
|
487
|
+
* splits each into its action metadata and payload (with the `doc` and/or `upsert` properties),
|
|
488
|
+
* and returns a BulkRequest payload formatted as a flat array.
|
|
489
|
+
*
|
|
490
|
+
* @param index - The name of the index.
|
|
491
|
+
* @param updates - An array of update actions.
|
|
492
|
+
* @param idFn - A function that returns a unique _id for each document.
|
|
493
|
+
* @returns A BulkRequest payload for update operations.
|
|
494
|
+
*/
|
|
495
|
+
declare function bulkUpdate<T extends IndexDefinition>(index: T['index'], updates: UpdateAction<T>[], idFn: IdFunction<T>): BulkRequest<T>;
|
|
496
|
+
/**
|
|
497
|
+
* Constructs a bulk request payload for deleting documents.
|
|
498
|
+
*
|
|
499
|
+
* For each document in the provided array, this helper creates a single‑line bulk operation:
|
|
500
|
+
* { delete: { _id: <id> } }
|
|
501
|
+
* The provided id generator function is used to compute the _id for each document.
|
|
502
|
+
*
|
|
503
|
+
* @param index - The name of the index.
|
|
504
|
+
* @param docs - An array of documents to delete.
|
|
505
|
+
* @param idFn - A function that returns the _id for a given document.
|
|
506
|
+
* @returns A BulkRequest payload for delete operations.
|
|
507
|
+
*/
|
|
508
|
+
declare function bulkDelete<T extends IndexDefinition>(index: T['index'], ids: Common$1.Id[]): BulkRequest<T>;
|
|
288
509
|
|
|
289
|
-
export { type
|
|
510
|
+
export { type BoolQuery, type BoostingQuery, type BulkRequest, type BulkResponse, type CombinedFieldsQuery, type CommonTermsQuery, type ConstantScoreQuery, type DateDecayFunction, type DateDistanceFeatureQuery, type DateRangeQuery, type DecayFunction, type DecayFunctionBase, type DeepPartial, type DisMaxQuery, type DistanceFeatureQuery, type DocumentFor, type ExistsQuery, type FieldAndFormat, type FieldQuery, type FieldValueFactorScoreFunction, type FunctionBoostMode, type FunctionScoreQuery, type FuzzyQuery, type GeoBoundingBoxQuery, type GeoDecayFunction, type GeoDistanceFeatureQuery, type GeoDistanceQuery, type GeoExecution, type GeoPolygonQuery, type GeoShapeQuery, type GeoValidationMethod, type HasChildQuery, type HasParentQuery, type HybridQuery, type IdFunction, type IdsQuery, type IndexDefinition, type IndexRequest, type IndexResponse, type IntervalsQuery, type KnnQuery, type Like, type LikeDocument, type MatchAllQuery, type MatchBoolPrefixQuery, type MatchNoneQuery, type MatchPhrasePrefixQuery, type MatchPhraseQuery, type MatchQuery, type MoreLikeThisQuery, type MultiMatchQuery, type NestedQuery, type NeuralQuery, type NumberRangeQuery, OpenSearchClient, type ParentIdQuery, type PercolateQuery, type PinnedQuery, type PrefixQuery, type Primitive, type QueryContainer, type QueryStringQuery, type RangeQuery, type RankFeatureQuery, type RegexpQuery, type ScriptQuery, type ScriptScoreQuery, type SearchRequest, type SearchResponse, type SimpleQueryStringQuery, type SpanContainingQuery, type SpanFieldMaskingQuery, type SpanFirstQuery, type SpanMultiTermQuery, type SpanNearQuery, type SpanNotQuery, type SpanOrQuery, type SpanQuery, type SpanTermQuery, type SpanWithinQuery, type TermQuery, type TermsQuery, type TermsSetQuery, type TypeQuery, type UpdateAction, type WildcardQuery, type WrapperQuery, type XyShapeQuery, bulkCreate, bulkDelete, bulkIndex, bulkUpdate };
|