@sebspark/opensearch 1.0.2 → 1.1.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/dist/index.d.mts +117 -124
- package/dist/index.d.ts +117 -124
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
-
import { Bulk_Request, Bulk_ResponseBody, Search_Request, Search_RequestBody, Search_Response, Search_ResponseBody, Index_Request, Indices_Exists_Request, Index_Response, Indices_Exists_Response } from '@opensearch-project/opensearch/api';
|
|
3
|
-
import { TransportRequestOptions, TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport';
|
|
4
|
-
import { Common_Mapping, Core_Bulk, Common as Common$1, Common_QueryDsl } from '@opensearch-project/opensearch/api/_types';
|
|
5
|
-
import { Indices_Create_Request, Indices_Create_RequestBody } from '@opensearch-project/opensearch/api/';
|
|
6
|
-
import * as Common from '@opensearch-project/opensearch/api/_types/_common';
|
|
7
|
-
import OpenSearchAPI from '@opensearch-project/opensearch/api/OpenSearchApi';
|
|
8
|
-
import * as CoreSearch from '@opensearch-project/opensearch/api/_types/_core.search';
|
|
1
|
+
import { API, Types, Client } from '@opensearch-project/opensearch';
|
|
9
2
|
|
|
10
3
|
type DeepPartial<T> = {
|
|
11
4
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
@@ -21,27 +14,27 @@ type Primitive = string | number | boolean;
|
|
|
21
14
|
/**
|
|
22
15
|
* Defines all possible field value types in OpenSearch.
|
|
23
16
|
*/
|
|
24
|
-
type FieldValue = Common.FieldValue;
|
|
17
|
+
type FieldValue = Types.Common.FieldValue;
|
|
25
18
|
/**
|
|
26
19
|
* Defines an OpenSearch field with optional properties.
|
|
27
20
|
*/
|
|
28
|
-
type Property = Common_Mapping.Property;
|
|
21
|
+
type Property = Types.Common_Mapping.Property;
|
|
29
22
|
/**
|
|
30
23
|
* Defines an OpenSearch index mapping.
|
|
31
24
|
*/
|
|
32
|
-
type TypeMapping = Omit<Common_Mapping.TypeMapping, 'properties'> & {
|
|
25
|
+
type TypeMapping = Omit<Types.Common_Mapping.TypeMapping, 'properties'> & {
|
|
33
26
|
properties: Record<string, Property>;
|
|
34
27
|
};
|
|
35
28
|
/**
|
|
36
29
|
* Defines an OpenSearch index mapping configuration.
|
|
37
30
|
*/
|
|
38
|
-
type IndicesCreateRequestBody = Omit<Indices_Create_RequestBody, 'mappings'> & {
|
|
31
|
+
type IndicesCreateRequestBody = Omit<API.Indices_Create_RequestBody, 'mappings'> & {
|
|
39
32
|
mappings: TypeMapping;
|
|
40
33
|
};
|
|
41
34
|
/**
|
|
42
35
|
* Defines an OpenSearch index with body required.
|
|
43
36
|
*/
|
|
44
|
-
type IndexDefinition = Omit<Indices_Create_Request, 'body'> & {
|
|
37
|
+
type IndexDefinition = Omit<API.Indices_Create_Request, 'body'> & {
|
|
45
38
|
body: IndicesCreateRequestBody;
|
|
46
39
|
};
|
|
47
40
|
/**
|
|
@@ -61,14 +54,19 @@ type MapQueryProperties<T extends IndexDefinition> = T extends {
|
|
|
61
54
|
};
|
|
62
55
|
};
|
|
63
56
|
} ? MapOpenSearchTypes<P> : never;
|
|
64
|
-
type Indices =
|
|
57
|
+
type Indices = Client['indices'];
|
|
58
|
+
type TransportRequestOptions = Parameters<Indices['exists']>[1];
|
|
59
|
+
interface TransportRequestPromise<T> extends Promise<T> {
|
|
60
|
+
abort: () => void;
|
|
61
|
+
finally(onFinally?: (() => void) | undefined | null): Promise<T>;
|
|
62
|
+
}
|
|
65
63
|
type Sort<T> = SortOptions<T> | SortOptions<T>[];
|
|
66
64
|
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>;
|
|
65
|
+
_doc?: Types.Common.ScoreSort;
|
|
66
|
+
_geo_distance?: Types.Common.GeoDistanceSort;
|
|
67
|
+
_score?: Types.Common.ScoreSort;
|
|
68
|
+
_script?: Types.Common.ScriptSort;
|
|
69
|
+
} | Record<NestedPaths<T>, Types.Common.FieldSort>;
|
|
72
70
|
type BuiltinKeys = '_id' | '_index';
|
|
73
71
|
|
|
74
72
|
type DocumentFor<T extends IndexDefinition> = {
|
|
@@ -76,18 +74,18 @@ type DocumentFor<T extends IndexDefinition> = {
|
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
type CreateOperation<T extends IndexDefinition> = Omit<WriteOperation<T>, '_id'> & {
|
|
79
|
-
_id: Common
|
|
77
|
+
_id: Types.Common.Id;
|
|
80
78
|
};
|
|
81
79
|
type DeleteOperation<T extends IndexDefinition> = OperationBase<T>;
|
|
82
80
|
type IndexOperation<T extends IndexDefinition> = WriteOperation<T>;
|
|
83
|
-
type UpdateOperation<T extends IndexDefinition> = Omit<Core_Bulk.UpdateOperation, '_index' | '_id'> & {
|
|
84
|
-
_id: Common
|
|
81
|
+
type UpdateOperation<T extends IndexDefinition> = Omit<Types.Core_Bulk.UpdateOperation, '_index' | '_id'> & {
|
|
82
|
+
_id: Types.Common.Id;
|
|
85
83
|
_index?: T['index'];
|
|
86
84
|
};
|
|
87
|
-
type WriteOperation<T extends IndexDefinition> = Omit<Core_Bulk.WriteOperation, '_index'> & {
|
|
85
|
+
type WriteOperation<T extends IndexDefinition> = Omit<Types.Core_Bulk.WriteOperation, '_index'> & {
|
|
88
86
|
_index?: T['index'];
|
|
89
87
|
};
|
|
90
|
-
type OperationBase<T extends IndexDefinition> = Omit<Core_Bulk.OperationBase, '_index'> & {
|
|
88
|
+
type OperationBase<T extends IndexDefinition> = Omit<Types.Core_Bulk.OperationBase, '_index'> & {
|
|
91
89
|
_index?: T['index'];
|
|
92
90
|
};
|
|
93
91
|
type OperationContainer<T extends IndexDefinition> = {
|
|
@@ -96,154 +94,149 @@ type OperationContainer<T extends IndexDefinition> = {
|
|
|
96
94
|
index?: IndexOperation<T>;
|
|
97
95
|
update?: UpdateOperation<T>;
|
|
98
96
|
};
|
|
99
|
-
type UpdateAction<T extends IndexDefinition> = Omit<Core_Bulk.UpdateAction, 'doc' | 'upsert'> & ({
|
|
97
|
+
type UpdateAction<T extends IndexDefinition> = Omit<Types.Core_Bulk.UpdateAction, 'doc' | 'upsert'> & ({
|
|
100
98
|
doc: DeepPartial<DocumentFor<T>>;
|
|
101
99
|
upsert?: DocumentFor<T>;
|
|
102
100
|
} | {
|
|
103
101
|
doc?: DeepPartial<DocumentFor<T>>;
|
|
104
102
|
upsert: DocumentFor<T>;
|
|
105
103
|
});
|
|
106
|
-
type BulkRequest<T extends IndexDefinition> = Omit<Bulk_Request, 'index' | 'body' | '_source_excludes' | '_source_includes'> & {
|
|
104
|
+
type BulkRequest<T extends IndexDefinition> = Omit<API.Bulk_Request, 'index' | 'body' | '_source_excludes' | '_source_includes'> & {
|
|
107
105
|
index: T['index'];
|
|
108
106
|
body: BulkRequestBody<T>;
|
|
109
|
-
_source_excludes?: NestedLeafPaths<T> | Common
|
|
110
|
-
_source_includes?: NestedLeafPaths<T> | Common
|
|
107
|
+
_source_excludes?: NestedLeafPaths<T> | Types.Common.Fields;
|
|
108
|
+
_source_includes?: NestedLeafPaths<T> | Types.Common.Fields;
|
|
111
109
|
};
|
|
112
110
|
type BulkRequestBody<T extends IndexDefinition> = (OperationContainer<T> | UpdateAction<T> | DocumentFor<T>)[];
|
|
113
|
-
type ResponseItem<T extends IndexDefinition> = Omit<Core_Bulk.ResponseItem, '_index'> & {
|
|
111
|
+
type ResponseItem<T extends IndexDefinition> = Omit<Types.Core_Bulk.ResponseItem, '_index'> & {
|
|
114
112
|
_index: T['index'];
|
|
115
113
|
};
|
|
116
114
|
type CustomOperation = string;
|
|
117
115
|
type BulkOperation = 'index' | 'update' | 'delete' | 'create' | CustomOperation;
|
|
118
|
-
type BulkResponseBody<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'items'> & {
|
|
116
|
+
type BulkResponseBody<T extends IndexDefinition> = Omit<API.Bulk_ResponseBody, 'items'> & {
|
|
119
117
|
items: Record<BulkOperation, ResponseItem<T>>[];
|
|
120
118
|
};
|
|
121
|
-
type BulkResponse<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'body'> & {
|
|
119
|
+
type BulkResponse<T extends IndexDefinition> = Omit<API.Bulk_ResponseBody, 'body'> & {
|
|
122
120
|
body: BulkResponseBody<T>;
|
|
123
121
|
};
|
|
124
122
|
|
|
125
|
-
type BoolQuery<T> = Omit<Common_QueryDsl.BoolQuery, 'must' | 'should' | 'filter' | 'must_not'> & {
|
|
123
|
+
type BoolQuery<T> = Omit<Types.Common_QueryDsl.BoolQuery, 'must' | 'should' | 'filter' | 'must_not'> & {
|
|
126
124
|
must?: QueryContainer<T>[];
|
|
127
125
|
should?: QueryContainer<T>[];
|
|
128
126
|
filter?: QueryContainer<T>[];
|
|
129
127
|
must_not?: QueryContainer<T>[];
|
|
130
128
|
};
|
|
131
|
-
type BoostingQuery<T> = Omit<Common_QueryDsl.BoostingQuery, 'positive' | 'negative'> & {
|
|
129
|
+
type BoostingQuery<T> = Omit<Types.Common_QueryDsl.BoostingQuery, 'positive' | 'negative'> & {
|
|
132
130
|
positive: QueryContainer<T>;
|
|
133
131
|
negative: QueryContainer<T>;
|
|
134
132
|
};
|
|
135
|
-
type CombinedFieldsQuery<T> = Omit<Common_QueryDsl.CombinedFieldsQuery, 'fields'> & {
|
|
133
|
+
type CombinedFieldsQuery<T> = Omit<Types.Common_QueryDsl.CombinedFieldsQuery, 'fields'> & {
|
|
136
134
|
fields: NestedPaths<T>[];
|
|
137
135
|
};
|
|
138
|
-
type CommonTermsQuery = Common_QueryDsl.CommonTermsQuery;
|
|
139
|
-
type ConstantScoreQuery<T> = Omit<Common_QueryDsl.ConstantScoreQuery, 'filter'> & {
|
|
136
|
+
type CommonTermsQuery = Types.Common_QueryDsl.CommonTermsQuery;
|
|
137
|
+
type ConstantScoreQuery<T> = Omit<Types.Common_QueryDsl.ConstantScoreQuery, 'filter'> & {
|
|
140
138
|
filter: QueryContainer<T>;
|
|
141
139
|
};
|
|
142
|
-
type
|
|
143
|
-
type
|
|
144
|
-
type
|
|
145
|
-
type DecayFunction = Common_QueryDsl.DecayFunction;
|
|
146
|
-
type DecayFunctionBase = Common_QueryDsl.DecayFunctionBase;
|
|
147
|
-
type DisMaxQuery<T> = Omit<Common_QueryDsl.DisMaxQuery, 'queries'> & {
|
|
140
|
+
type DecayFunction = Types.Common_QueryDsl.DecayFunction;
|
|
141
|
+
type DecayFunctionBase = Types.Common_QueryDsl.DecayFunctionBase;
|
|
142
|
+
type DisMaxQuery<T> = Omit<Types.Common_QueryDsl.DisMaxQuery, 'queries'> & {
|
|
148
143
|
queries: QueryContainer<T>[];
|
|
149
144
|
};
|
|
150
|
-
type DistanceFeatureQuery<T> = Omit<Common_QueryDsl.DistanceFeatureQuery, 'field'> & {
|
|
145
|
+
type DistanceFeatureQuery<T> = Omit<Types.Common_QueryDsl.DistanceFeatureQuery, 'field'> & {
|
|
151
146
|
field: NestedPaths<T>;
|
|
152
147
|
};
|
|
153
|
-
type ExistsQuery<T> = Omit<Common_QueryDsl.ExistsQuery, 'field'> & {
|
|
148
|
+
type ExistsQuery<T> = Omit<Types.Common_QueryDsl.ExistsQuery, 'field'> & {
|
|
154
149
|
field: NestedPaths<T>;
|
|
155
150
|
};
|
|
156
|
-
type FieldAndFormat<T> = Omit<Common_QueryDsl.FieldAndFormat, 'field'> & {
|
|
151
|
+
type FieldAndFormat<T> = Omit<Types.Common_QueryDsl.FieldAndFormat, 'field'> & {
|
|
157
152
|
field: NestedPaths<T>;
|
|
158
153
|
};
|
|
159
154
|
type FieldQuery<T, K> = Partial<Record<NestedLeafPaths<T> | BuiltinKeys, K>>;
|
|
160
|
-
type FieldValueFactorScoreFunction<T> = Omit<Common_QueryDsl.FieldValueFactorScoreFunction, 'field'> & {
|
|
155
|
+
type FieldValueFactorScoreFunction<T> = Omit<Types.Common_QueryDsl.FieldValueFactorScoreFunction, 'field'> & {
|
|
161
156
|
field: NestedPaths<T>;
|
|
162
157
|
};
|
|
163
|
-
type FunctionBoostMode = Common_QueryDsl.FunctionBoostMode;
|
|
164
|
-
type FunctionScoreQuery<T> = Omit<Common_QueryDsl.FunctionScoreQuery, 'query'> & {
|
|
158
|
+
type FunctionBoostMode = Types.Common_QueryDsl.FunctionBoostMode;
|
|
159
|
+
type FunctionScoreQuery<T> = Omit<Types.Common_QueryDsl.FunctionScoreQuery, 'query'> & {
|
|
165
160
|
query?: QueryContainer<T> | undefined;
|
|
166
161
|
};
|
|
167
|
-
type FuzzyQuery = Common_QueryDsl.FuzzyQuery;
|
|
168
|
-
type GeoBoundingBoxQuery = Common_QueryDsl.GeoBoundingBoxQuery;
|
|
169
|
-
type
|
|
170
|
-
type
|
|
171
|
-
type
|
|
172
|
-
type GeoExecution = Common_QueryDsl.GeoExecution;
|
|
173
|
-
type GeoPolygonQuery<T> = Omit<Common_QueryDsl.GeoPolygonQuery, 'field'> & {
|
|
162
|
+
type FuzzyQuery = Types.Common_QueryDsl.FuzzyQuery;
|
|
163
|
+
type GeoBoundingBoxQuery = Types.Common_QueryDsl.GeoBoundingBoxQuery;
|
|
164
|
+
type GeoDistanceQuery = Types.Common_QueryDsl.GeoDistanceQuery;
|
|
165
|
+
type GeoExecution = Types.Common_QueryDsl.GeoExecution;
|
|
166
|
+
type GeoPolygonQuery<T> = Omit<Types.Common_QueryDsl.GeoPolygonQuery, 'field'> & {
|
|
174
167
|
field: NestedPaths<T>;
|
|
175
168
|
};
|
|
176
|
-
type GeoShapeQuery<T> = Omit<Common_QueryDsl.GeoShapeQuery, 'ignore_unmapped' | 'field'> & {
|
|
169
|
+
type GeoShapeQuery<T> = Omit<Types.Common_QueryDsl.GeoShapeQuery, 'ignore_unmapped' | 'field'> & {
|
|
177
170
|
field: NestedPaths<T>;
|
|
178
171
|
};
|
|
179
|
-
type GeoValidationMethod = Common_QueryDsl.GeoValidationMethod;
|
|
180
|
-
type HasChildQuery<T> = Omit<Common_QueryDsl.HasChildQuery, 'query'> & {
|
|
172
|
+
type GeoValidationMethod = Types.Common_QueryDsl.GeoValidationMethod;
|
|
173
|
+
type HasChildQuery<T> = Omit<Types.Common_QueryDsl.HasChildQuery, 'query'> & {
|
|
181
174
|
query: QueryContainer<T>;
|
|
182
175
|
};
|
|
183
|
-
type HasParentQuery<T> = Omit<Common_QueryDsl.HasParentQuery, 'query'> & {
|
|
176
|
+
type HasParentQuery<T> = Omit<Types.Common_QueryDsl.HasParentQuery, 'query'> & {
|
|
184
177
|
query: QueryContainer<T>;
|
|
185
178
|
};
|
|
186
|
-
type HybridQuery<T> = Omit<Common_QueryDsl.HybridQuery, 'queries'> & {
|
|
179
|
+
type HybridQuery<T> = Omit<Types.Common_QueryDsl.HybridQuery, 'queries'> & {
|
|
187
180
|
queries?: QueryContainer<T>[];
|
|
188
181
|
};
|
|
189
|
-
type IdsQuery = Common_QueryDsl.IdsQuery;
|
|
190
|
-
type IntervalsQuery = Common_QueryDsl.IntervalsQuery;
|
|
191
|
-
type KnnQuery<T> = Omit<Common_QueryDsl.KnnQuery, 'filter'> & {
|
|
182
|
+
type IdsQuery = Types.Common_QueryDsl.IdsQuery;
|
|
183
|
+
type IntervalsQuery = Types.Common_QueryDsl.IntervalsQuery;
|
|
184
|
+
type KnnQuery<T> = Omit<Types.Common_QueryDsl.KnnQuery, 'filter'> & {
|
|
192
185
|
filter?: QueryContainer<T>[];
|
|
193
186
|
};
|
|
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'> & {
|
|
187
|
+
type Like = Types.Common_QueryDsl.Like;
|
|
188
|
+
type LikeDocument = Types.Common_QueryDsl.LikeDocument;
|
|
189
|
+
type MatchAllQuery = Types.Common_QueryDsl.MatchAllQuery;
|
|
190
|
+
type MatchBoolPrefixQuery<T> = Omit<Types.Common_QueryDsl.MatchBoolPrefixQuery, 'query' | 'fields'> & {
|
|
198
191
|
fields: NestedPaths<T>[];
|
|
199
192
|
query: string;
|
|
200
193
|
};
|
|
201
|
-
type MatchNoneQuery = Common_QueryDsl.MatchNoneQuery;
|
|
202
|
-
type MatchPhrasePrefixQuery<T> = Omit<Common_QueryDsl.MatchPhrasePrefixQuery, 'query' | 'field'> & {
|
|
194
|
+
type MatchNoneQuery = Types.Common_QueryDsl.MatchNoneQuery;
|
|
195
|
+
type MatchPhrasePrefixQuery<T> = Omit<Types.Common_QueryDsl.MatchPhrasePrefixQuery, 'query' | 'field'> & {
|
|
203
196
|
field: NestedPaths<T>;
|
|
204
197
|
query: string;
|
|
205
198
|
};
|
|
206
|
-
type MatchPhraseQuery<T> = Omit<Common_QueryDsl.MatchPhraseQuery, 'query' | 'field'> & {
|
|
199
|
+
type MatchPhraseQuery<T> = Omit<Types.Common_QueryDsl.MatchPhraseQuery, 'query' | 'field'> & {
|
|
207
200
|
field: NestedPaths<T>;
|
|
208
201
|
query: string;
|
|
209
202
|
};
|
|
210
|
-
type MatchQuery = FieldValue | Common_QueryDsl.MatchQuery;
|
|
211
|
-
type MoreLikeThisQuery<T> = Omit<Common_QueryDsl.MoreLikeThisQuery, 'fields'> & {
|
|
203
|
+
type MatchQuery = FieldValue | Types.Common_QueryDsl.MatchQuery;
|
|
204
|
+
type MoreLikeThisQuery<T> = Omit<Types.Common_QueryDsl.MoreLikeThisQuery, 'fields'> & {
|
|
212
205
|
fields?: NestedPaths<T>[];
|
|
213
206
|
};
|
|
214
|
-
type MultiMatchQuery<T> = Omit<Common_QueryDsl.MultiMatchQuery, 'fields'> & {
|
|
207
|
+
type MultiMatchQuery<T> = Omit<Types.Common_QueryDsl.MultiMatchQuery, 'fields'> & {
|
|
215
208
|
fields?: NestedPaths<T>[];
|
|
216
209
|
};
|
|
217
|
-
type NestedQuery<T> = Omit<Common_QueryDsl.NestedQuery, 'query' | 'path'> & {
|
|
210
|
+
type NestedQuery<T> = Omit<Types.Common_QueryDsl.NestedQuery, 'query' | 'path'> & {
|
|
218
211
|
path: NestedPaths<T>;
|
|
219
212
|
query: QueryContainer<T>;
|
|
220
213
|
};
|
|
221
|
-
type NeuralQuery<T> = Omit<Common_QueryDsl.NeuralQuery, 'filter'> & {
|
|
214
|
+
type NeuralQuery<T> = Omit<Types.Common_QueryDsl.NeuralQuery, 'filter'> & {
|
|
222
215
|
filter?: QueryContainer<T>;
|
|
223
216
|
};
|
|
224
|
-
type
|
|
217
|
+
type NumberRangeQueryParameters<T> = Omit<Types.Common_QueryDsl.NumberRangeQueryParameters, 'field'> & {
|
|
225
218
|
field: NestedPaths<T>;
|
|
226
219
|
};
|
|
227
|
-
type ParentIdQuery = Common_QueryDsl.ParentIdQuery;
|
|
228
|
-
type PercolateQuery<T> = Omit<Common_QueryDsl.PercolateQuery, 'field'> & {
|
|
220
|
+
type ParentIdQuery = Types.Common_QueryDsl.ParentIdQuery;
|
|
221
|
+
type PercolateQuery<T> = Omit<Types.Common_QueryDsl.PercolateQuery, 'field'> & {
|
|
229
222
|
field: NestedPaths<T>;
|
|
230
223
|
};
|
|
231
|
-
type PinnedQuery = Common_QueryDsl.PinnedQuery;
|
|
232
|
-
type PrefixQuery<T> = Omit<Common_QueryDsl.PrefixQuery, 'value' | 'field'> & {
|
|
224
|
+
type PinnedQuery = Types.Common_QueryDsl.PinnedQuery;
|
|
225
|
+
type PrefixQuery<T> = Omit<Types.Common_QueryDsl.PrefixQuery, 'value' | 'field'> & {
|
|
233
226
|
field: NestedPaths<T>;
|
|
234
227
|
value: MapOpenSearchTypes<T>;
|
|
235
228
|
};
|
|
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'> & {
|
|
229
|
+
type QueryContainer<T> = Omit<Types.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
230
|
bool?: BoolQuery<T>;
|
|
238
231
|
boosting?: BoostingQuery<T>;
|
|
239
232
|
combined_fields?: CombinedFieldsQuery<T>;
|
|
240
|
-
common?: FieldQuery<T, Common_QueryDsl.CommonTermsQuery>;
|
|
233
|
+
common?: FieldQuery<T, Types.Common_QueryDsl.CommonTermsQuery>;
|
|
241
234
|
constant_score?: ConstantScoreQuery<T>;
|
|
242
235
|
dis_max?: DisMaxQuery<T>;
|
|
243
236
|
distance_feature?: DistanceFeatureQuery<T>;
|
|
244
237
|
exists?: ExistsQuery<T>;
|
|
245
238
|
function_score?: FunctionScoreQuery<T>;
|
|
246
|
-
fuzzy?: FieldQuery<T, Common_QueryDsl.FuzzyQuery>;
|
|
239
|
+
fuzzy?: FieldQuery<T, Types.Common_QueryDsl.FuzzyQuery>;
|
|
247
240
|
geo_bounding_box?: GeoBoundingBoxQuery;
|
|
248
241
|
geo_distance?: GeoDistanceQuery;
|
|
249
242
|
geo_polygon?: GeoPolygonQuery<T>;
|
|
@@ -291,23 +284,23 @@ type QueryContainer<T> = Omit<Common_QueryDsl.QueryContainer, 'bool' | 'boosting
|
|
|
291
284
|
wrapper?: WrapperQuery;
|
|
292
285
|
xy_shape?: XyShapeQuery<T>;
|
|
293
286
|
};
|
|
294
|
-
type QueryStringQuery = Common_QueryDsl.QueryStringQuery;
|
|
295
|
-
type RangeQuery<T> = Omit<Common_QueryDsl.RangeQuery, 'field'> & {
|
|
287
|
+
type QueryStringQuery = Types.Common_QueryDsl.QueryStringQuery;
|
|
288
|
+
type RangeQuery<T> = Omit<Types.Common_QueryDsl.RangeQuery, 'field'> & {
|
|
296
289
|
field: NestedPaths<T>;
|
|
297
290
|
};
|
|
298
|
-
type RankFeatureQuery = Common_QueryDsl.RankFeatureQuery;
|
|
299
|
-
type RegexpQuery<T> = Omit<Common_QueryDsl.RegexpQuery, 'value' | 'field'> & {
|
|
291
|
+
type RankFeatureQuery = Types.Common_QueryDsl.RankFeatureQuery;
|
|
292
|
+
type RegexpQuery<T> = Omit<Types.Common_QueryDsl.RegexpQuery, 'value' | 'field'> & {
|
|
300
293
|
field: NestedPaths<T>;
|
|
301
294
|
value: MapOpenSearchTypes<T>;
|
|
302
295
|
};
|
|
303
|
-
type ScriptQuery = Common_QueryDsl.ScriptQuery;
|
|
304
|
-
type ScriptScoreQuery<T> = Omit<Common_QueryDsl.ScriptScoreQuery, 'query'> & {
|
|
296
|
+
type ScriptQuery = Types.Common_QueryDsl.ScriptQuery;
|
|
297
|
+
type ScriptScoreQuery<T> = Omit<Types.Common_QueryDsl.ScriptScoreQuery, 'query'> & {
|
|
305
298
|
query?: QueryContainer<T>;
|
|
306
299
|
};
|
|
307
|
-
type SimpleQueryStringQuery<T> = Omit<Common_QueryDsl.SimpleQueryStringQuery, 'fields'> & {
|
|
300
|
+
type SimpleQueryStringQuery<T> = Omit<Types.Common_QueryDsl.SimpleQueryStringQuery, 'fields'> & {
|
|
308
301
|
fields: NestedLeafPaths<T>[];
|
|
309
302
|
};
|
|
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'> & {
|
|
303
|
+
type SpanQuery<T> = Omit<Types.Common_QueryDsl.SpanQuery, 'field_masking_span' | 'span_containing' | 'span_first' | 'span_multi' | 'span_near' | 'span_not' | 'span_or' | 'span_term' | 'span_within'> & {
|
|
311
304
|
field_masking_span?: SpanFieldMaskingQuery<T>;
|
|
312
305
|
span_containing?: SpanContainingQuery<T>;
|
|
313
306
|
span_first?: SpanFirstQuery<T>;
|
|
@@ -318,70 +311,70 @@ type SpanQuery<T> = Omit<Common_QueryDsl.SpanQuery, 'field_masking_span' | 'span
|
|
|
318
311
|
span_term?: Record<NestedPaths<T>, SpanTermQuery<T>>;
|
|
319
312
|
span_within?: SpanWithinQuery<T>;
|
|
320
313
|
};
|
|
321
|
-
type SpanContainingQuery<T> = Omit<Common_QueryDsl.SpanContainingQuery, 'big' | 'little'> & {
|
|
314
|
+
type SpanContainingQuery<T> = Omit<Types.Common_QueryDsl.SpanContainingQuery, 'big' | 'little'> & {
|
|
322
315
|
big: SpanQuery<T>;
|
|
323
316
|
little: SpanQuery<T>;
|
|
324
317
|
};
|
|
325
|
-
type SpanFieldMaskingQuery<T> = Omit<Common_QueryDsl.SpanFieldMaskingQuery, 'field' | 'query'> & {
|
|
318
|
+
type SpanFieldMaskingQuery<T> = Omit<Types.Common_QueryDsl.SpanFieldMaskingQuery, 'field' | 'query'> & {
|
|
326
319
|
field: NestedPaths<T>;
|
|
327
320
|
query: SpanQuery<T>;
|
|
328
321
|
};
|
|
329
|
-
type SpanFirstQuery<T> = Omit<Common_QueryDsl.SpanFirstQuery, 'match'> & {
|
|
322
|
+
type SpanFirstQuery<T> = Omit<Types.Common_QueryDsl.SpanFirstQuery, 'match'> & {
|
|
330
323
|
match: SpanQuery<T>;
|
|
331
324
|
};
|
|
332
|
-
type SpanMultiTermQuery<T> = Omit<Common_QueryDsl.SpanMultiTermQuery, 'match'> & {
|
|
325
|
+
type SpanMultiTermQuery<T> = Omit<Types.Common_QueryDsl.SpanMultiTermQuery, 'match'> & {
|
|
333
326
|
match: QueryContainer<T>;
|
|
334
327
|
};
|
|
335
|
-
type SpanNearQuery<T> = Omit<Common_QueryDsl.SpanNearQuery, 'clauses'> & {
|
|
328
|
+
type SpanNearQuery<T> = Omit<Types.Common_QueryDsl.SpanNearQuery, 'clauses'> & {
|
|
336
329
|
clauses: SpanQuery<T>[];
|
|
337
330
|
};
|
|
338
|
-
type SpanNotQuery<T> = Omit<Common_QueryDsl.SpanNotQuery, 'include' | 'exclude'> & {
|
|
331
|
+
type SpanNotQuery<T> = Omit<Types.Common_QueryDsl.SpanNotQuery, 'include' | 'exclude'> & {
|
|
339
332
|
include: SpanQuery<T>;
|
|
340
333
|
exclude: SpanQuery<T>;
|
|
341
334
|
};
|
|
342
|
-
type SpanOrQuery<T> = Omit<Common_QueryDsl.SpanOrQuery, 'clauses'> & {
|
|
335
|
+
type SpanOrQuery<T> = Omit<Types.Common_QueryDsl.SpanOrQuery, 'clauses'> & {
|
|
343
336
|
clauses: SpanQuery<T>[];
|
|
344
337
|
};
|
|
345
|
-
type SpanTermQuery<T> = Omit<Common_QueryDsl.SpanTermQuery, 'value' | 'field'> & {
|
|
338
|
+
type SpanTermQuery<T> = Omit<Types.Common_QueryDsl.SpanTermQuery, 'value' | 'field'> & {
|
|
346
339
|
field: NestedPaths<T>;
|
|
347
340
|
value: MapOpenSearchTypes<T>;
|
|
348
341
|
};
|
|
349
|
-
type SpanWithinQuery<T> = Omit<Common_QueryDsl.SpanWithinQuery, 'big' | 'little'> & {
|
|
342
|
+
type SpanWithinQuery<T> = Omit<Types.Common_QueryDsl.SpanWithinQuery, 'big' | 'little'> & {
|
|
350
343
|
big: SpanQuery<T>;
|
|
351
344
|
little: SpanQuery<T>;
|
|
352
345
|
};
|
|
353
|
-
type TermQuery<T> = Omit<Common_QueryDsl.TermQuery, 'value' | 'field'> & {
|
|
346
|
+
type TermQuery<T> = Omit<Types.Common_QueryDsl.TermQuery, 'value' | 'field'> & {
|
|
354
347
|
field: NestedPaths<T>;
|
|
355
348
|
value: MapOpenSearchTypes<T>;
|
|
356
349
|
};
|
|
357
|
-
type TermsQuery<T> = Omit<Common_QueryDsl.TermsQuery, 'terms' | 'field'> & {
|
|
350
|
+
type TermsQuery<T> = Omit<Types.Common_QueryDsl.TermsQuery, 'terms' | 'field'> & {
|
|
358
351
|
field: NestedPaths<T>;
|
|
359
352
|
terms: FieldValue[];
|
|
360
353
|
};
|
|
361
|
-
type TermsSetQuery<T> = Omit<Common_QueryDsl.TermsSetQuery, 'terms' | 'field'> & {
|
|
354
|
+
type TermsSetQuery<T> = Omit<Types.Common_QueryDsl.TermsSetQuery, 'terms' | 'field'> & {
|
|
362
355
|
field: NestedPaths<T>;
|
|
363
356
|
terms: FieldValue[];
|
|
364
357
|
};
|
|
365
|
-
type TypeQuery = Common_QueryDsl.TypeQuery;
|
|
366
|
-
type WildcardQuery<T> = Omit<Common_QueryDsl.WildcardQuery, 'value' | 'field'> & {
|
|
358
|
+
type TypeQuery = Types.Common_QueryDsl.TypeQuery;
|
|
359
|
+
type WildcardQuery<T> = Omit<Types.Common_QueryDsl.WildcardQuery, 'value' | 'field'> & {
|
|
367
360
|
field: NestedPaths<T>;
|
|
368
361
|
value: MapOpenSearchTypes<T>;
|
|
369
362
|
};
|
|
370
|
-
type WrapperQuery = Common_QueryDsl.WrapperQuery;
|
|
371
|
-
type XyShapeQuery<T> = Omit<Common_QueryDsl.XyShapeQuery, 'field'> & {
|
|
363
|
+
type WrapperQuery = Types.Common_QueryDsl.WrapperQuery;
|
|
364
|
+
type XyShapeQuery<T> = Omit<Types.Common_QueryDsl.XyShapeQuery, 'field'> & {
|
|
372
365
|
field: NestedPaths<T>;
|
|
373
366
|
};
|
|
374
367
|
|
|
375
|
-
type FieldCollapse<T> = Omit<
|
|
368
|
+
type FieldCollapse<T> = Omit<Types.Core_Search.FieldCollapse, 'field'> & {
|
|
376
369
|
field: NestedPaths<T>;
|
|
377
370
|
};
|
|
378
|
-
type Highlight<T> = Omit<
|
|
379
|
-
fields: FieldQuery<T,
|
|
371
|
+
type Highlight<T> = Omit<Types.Core_Search.Highlight, 'fields'> & {
|
|
372
|
+
fields: FieldQuery<T, Types.Core_Search.HighlightField>;
|
|
380
373
|
};
|
|
381
|
-
type Hit<T extends IndexDefinition> = Omit<
|
|
374
|
+
type Hit<T extends IndexDefinition> = Omit<Types.Core_Search.Hit, '_source'> & {
|
|
382
375
|
_source: DocumentFor<T>;
|
|
383
376
|
};
|
|
384
|
-
type HitsMetadata<T extends IndexDefinition> = Omit<
|
|
377
|
+
type HitsMetadata<T extends IndexDefinition> = Omit<Types.Core_Search.HitsMetadata, 'hits'> & {
|
|
385
378
|
hits: Hit<T>[];
|
|
386
379
|
};
|
|
387
380
|
type SourceConfig<T> = boolean | SourceFilter<T>;
|
|
@@ -390,25 +383,25 @@ type SourceFilter<T> = NestedPaths<T>[] | {
|
|
|
390
383
|
includes?: NestedPaths<T>[];
|
|
391
384
|
};
|
|
392
385
|
|
|
393
|
-
type SearchRequest<T extends IndexDefinition> = Omit<Search_Request, 'body' | 'index'> & {
|
|
386
|
+
type SearchRequest<T extends IndexDefinition> = Omit<API.Search_Request, 'body' | 'index'> & {
|
|
394
387
|
index: T['index'];
|
|
395
388
|
body: SearchRequestBody<T>;
|
|
396
389
|
};
|
|
397
|
-
type SearchRequestBody<T extends IndexDefinition> = Omit<Search_RequestBody, 'query' | 'collapse' | 'highlight' | 'sort' | '_source'> & {
|
|
390
|
+
type SearchRequestBody<T extends IndexDefinition> = Omit<API.Search_RequestBody, 'query' | 'collapse' | 'highlight' | 'sort' | '_source'> & {
|
|
398
391
|
query?: QueryContainer<MapQueryProperties<T>>;
|
|
399
392
|
collapse?: FieldCollapse<MapQueryProperties<T>>;
|
|
400
393
|
highlight?: Highlight<MapQueryProperties<T>>;
|
|
401
394
|
sort?: Sort<MapQueryProperties<T>>;
|
|
402
395
|
_source?: SourceConfig<MapQueryProperties<T>>;
|
|
403
396
|
};
|
|
404
|
-
type SearchResponse<T extends IndexDefinition> = Omit<Search_Response, 'body'> & {
|
|
397
|
+
type SearchResponse<T extends IndexDefinition> = Omit<API.Search_Response, 'body'> & {
|
|
405
398
|
body: SearchResponseBody<T>;
|
|
406
399
|
};
|
|
407
|
-
type SearchResponseBody<T extends IndexDefinition> = Omit<Search_ResponseBody, 'hits'> & {
|
|
400
|
+
type SearchResponseBody<T extends IndexDefinition> = Omit<API.Search_ResponseBody, 'hits'> & {
|
|
408
401
|
hits: HitsMetadata<T>;
|
|
409
402
|
};
|
|
410
403
|
|
|
411
|
-
interface IndexRequest<T> extends Omit<Index_Request, 'body' | 'index'> {
|
|
404
|
+
interface IndexRequest<T> extends Omit<API.Index_Request, 'body' | 'index'> {
|
|
412
405
|
index: T extends {
|
|
413
406
|
index: infer I;
|
|
414
407
|
} ? I : never;
|
|
@@ -420,14 +413,14 @@ interface IndexRequest<T> extends Omit<Index_Request, 'body' | 'index'> {
|
|
|
420
413
|
};
|
|
421
414
|
} ? MapOpenSearchTypes<P> : never;
|
|
422
415
|
}
|
|
423
|
-
interface IndexResponse extends Index_Response {
|
|
416
|
+
interface IndexResponse extends API.Index_Response {
|
|
424
417
|
}
|
|
425
|
-
type IndicesExistsRequest<T extends IndexDefinition> = Omit<Indices_Exists_Request, 'index'> & {
|
|
418
|
+
type IndicesExistsRequest<T extends IndexDefinition> = Omit<API.Indices_Exists_Request, 'index'> & {
|
|
426
419
|
index: Extract<T['index'], string>;
|
|
427
420
|
};
|
|
428
421
|
|
|
429
422
|
type TypedIndices = Omit<Indices, 'exists'> & {
|
|
430
|
-
exists<T extends IndexDefinition>(params: IndicesExistsRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<Indices_Exists_Response>;
|
|
423
|
+
exists<T extends IndexDefinition>(params: IndicesExistsRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<API.Indices_Exists_Response>;
|
|
431
424
|
};
|
|
432
425
|
/**
|
|
433
426
|
* ✅ Constructor type that ensures `new OpenSearchClient()` works.
|
|
@@ -441,7 +434,7 @@ type OpenSearchClientConstructor = new (...args: ConstructorParameters<typeof Cl
|
|
|
441
434
|
*/
|
|
442
435
|
interface OpenSearchClient extends Omit<Client, 'search' | 'index' | 'bulk' | 'indices'> {
|
|
443
436
|
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>;
|
|
437
|
+
index<T extends IndexDefinition>(params: IndexRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<API.Index_Response>;
|
|
445
438
|
bulk<T extends IndexDefinition>(params: BulkRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<BulkResponse<T>>;
|
|
446
439
|
indices: TypedIndices;
|
|
447
440
|
}
|
|
@@ -453,7 +446,7 @@ interface OpenSearchClient extends Omit<Client, 'search' | 'index' | 'bulk' | 'i
|
|
|
453
446
|
*/
|
|
454
447
|
declare const OpenSearchClient: OpenSearchClientConstructor;
|
|
455
448
|
|
|
456
|
-
type IdFunction<T extends IndexDefinition> = (doc: DocumentFor<T>) => Common
|
|
449
|
+
type IdFunction<T extends IndexDefinition> = (doc: DocumentFor<T>) => Types.Common.Id;
|
|
457
450
|
/**
|
|
458
451
|
* Constructs a bulk request payload for indexing documents.
|
|
459
452
|
*
|
|
@@ -505,6 +498,6 @@ declare function bulkUpdate<T extends IndexDefinition>(index: T['index'], update
|
|
|
505
498
|
* @param idFn - A function that returns the _id for a given document.
|
|
506
499
|
* @returns A BulkRequest payload for delete operations.
|
|
507
500
|
*/
|
|
508
|
-
declare function bulkDelete<T extends IndexDefinition>(index: T['index'], ids: Common
|
|
501
|
+
declare function bulkDelete<T extends IndexDefinition>(index: T['index'], ids: Types.Common.Id[]): BulkRequest<T>;
|
|
509
502
|
|
|
510
|
-
export { type BoolQuery, type BoostingQuery, type BulkRequest, type BulkResponse, type CombinedFieldsQuery, type CommonTermsQuery, type ConstantScoreQuery, type
|
|
503
|
+
export { type BoolQuery, type BoostingQuery, type BulkRequest, type BulkResponse, type CombinedFieldsQuery, type CommonTermsQuery, type ConstantScoreQuery, 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 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 NumberRangeQueryParameters, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { Client } from '@opensearch-project/opensearch';
|
|
2
|
-
import { Bulk_Request, Bulk_ResponseBody, Search_Request, Search_RequestBody, Search_Response, Search_ResponseBody, Index_Request, Indices_Exists_Request, Index_Response, Indices_Exists_Response } from '@opensearch-project/opensearch/api';
|
|
3
|
-
import { TransportRequestOptions, TransportRequestPromise } from '@opensearch-project/opensearch/lib/Transport';
|
|
4
|
-
import { Common_Mapping, Core_Bulk, Common as Common$1, Common_QueryDsl } from '@opensearch-project/opensearch/api/_types';
|
|
5
|
-
import { Indices_Create_Request, Indices_Create_RequestBody } from '@opensearch-project/opensearch/api/';
|
|
6
|
-
import * as Common from '@opensearch-project/opensearch/api/_types/_common';
|
|
7
|
-
import OpenSearchAPI from '@opensearch-project/opensearch/api/OpenSearchApi';
|
|
8
|
-
import * as CoreSearch from '@opensearch-project/opensearch/api/_types/_core.search';
|
|
1
|
+
import { API, Types, Client } from '@opensearch-project/opensearch';
|
|
9
2
|
|
|
10
3
|
type DeepPartial<T> = {
|
|
11
4
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
@@ -21,27 +14,27 @@ type Primitive = string | number | boolean;
|
|
|
21
14
|
/**
|
|
22
15
|
* Defines all possible field value types in OpenSearch.
|
|
23
16
|
*/
|
|
24
|
-
type FieldValue = Common.FieldValue;
|
|
17
|
+
type FieldValue = Types.Common.FieldValue;
|
|
25
18
|
/**
|
|
26
19
|
* Defines an OpenSearch field with optional properties.
|
|
27
20
|
*/
|
|
28
|
-
type Property = Common_Mapping.Property;
|
|
21
|
+
type Property = Types.Common_Mapping.Property;
|
|
29
22
|
/**
|
|
30
23
|
* Defines an OpenSearch index mapping.
|
|
31
24
|
*/
|
|
32
|
-
type TypeMapping = Omit<Common_Mapping.TypeMapping, 'properties'> & {
|
|
25
|
+
type TypeMapping = Omit<Types.Common_Mapping.TypeMapping, 'properties'> & {
|
|
33
26
|
properties: Record<string, Property>;
|
|
34
27
|
};
|
|
35
28
|
/**
|
|
36
29
|
* Defines an OpenSearch index mapping configuration.
|
|
37
30
|
*/
|
|
38
|
-
type IndicesCreateRequestBody = Omit<Indices_Create_RequestBody, 'mappings'> & {
|
|
31
|
+
type IndicesCreateRequestBody = Omit<API.Indices_Create_RequestBody, 'mappings'> & {
|
|
39
32
|
mappings: TypeMapping;
|
|
40
33
|
};
|
|
41
34
|
/**
|
|
42
35
|
* Defines an OpenSearch index with body required.
|
|
43
36
|
*/
|
|
44
|
-
type IndexDefinition = Omit<Indices_Create_Request, 'body'> & {
|
|
37
|
+
type IndexDefinition = Omit<API.Indices_Create_Request, 'body'> & {
|
|
45
38
|
body: IndicesCreateRequestBody;
|
|
46
39
|
};
|
|
47
40
|
/**
|
|
@@ -61,14 +54,19 @@ type MapQueryProperties<T extends IndexDefinition> = T extends {
|
|
|
61
54
|
};
|
|
62
55
|
};
|
|
63
56
|
} ? MapOpenSearchTypes<P> : never;
|
|
64
|
-
type Indices =
|
|
57
|
+
type Indices = Client['indices'];
|
|
58
|
+
type TransportRequestOptions = Parameters<Indices['exists']>[1];
|
|
59
|
+
interface TransportRequestPromise<T> extends Promise<T> {
|
|
60
|
+
abort: () => void;
|
|
61
|
+
finally(onFinally?: (() => void) | undefined | null): Promise<T>;
|
|
62
|
+
}
|
|
65
63
|
type Sort<T> = SortOptions<T> | SortOptions<T>[];
|
|
66
64
|
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>;
|
|
65
|
+
_doc?: Types.Common.ScoreSort;
|
|
66
|
+
_geo_distance?: Types.Common.GeoDistanceSort;
|
|
67
|
+
_score?: Types.Common.ScoreSort;
|
|
68
|
+
_script?: Types.Common.ScriptSort;
|
|
69
|
+
} | Record<NestedPaths<T>, Types.Common.FieldSort>;
|
|
72
70
|
type BuiltinKeys = '_id' | '_index';
|
|
73
71
|
|
|
74
72
|
type DocumentFor<T extends IndexDefinition> = {
|
|
@@ -76,18 +74,18 @@ type DocumentFor<T extends IndexDefinition> = {
|
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
type CreateOperation<T extends IndexDefinition> = Omit<WriteOperation<T>, '_id'> & {
|
|
79
|
-
_id: Common
|
|
77
|
+
_id: Types.Common.Id;
|
|
80
78
|
};
|
|
81
79
|
type DeleteOperation<T extends IndexDefinition> = OperationBase<T>;
|
|
82
80
|
type IndexOperation<T extends IndexDefinition> = WriteOperation<T>;
|
|
83
|
-
type UpdateOperation<T extends IndexDefinition> = Omit<Core_Bulk.UpdateOperation, '_index' | '_id'> & {
|
|
84
|
-
_id: Common
|
|
81
|
+
type UpdateOperation<T extends IndexDefinition> = Omit<Types.Core_Bulk.UpdateOperation, '_index' | '_id'> & {
|
|
82
|
+
_id: Types.Common.Id;
|
|
85
83
|
_index?: T['index'];
|
|
86
84
|
};
|
|
87
|
-
type WriteOperation<T extends IndexDefinition> = Omit<Core_Bulk.WriteOperation, '_index'> & {
|
|
85
|
+
type WriteOperation<T extends IndexDefinition> = Omit<Types.Core_Bulk.WriteOperation, '_index'> & {
|
|
88
86
|
_index?: T['index'];
|
|
89
87
|
};
|
|
90
|
-
type OperationBase<T extends IndexDefinition> = Omit<Core_Bulk.OperationBase, '_index'> & {
|
|
88
|
+
type OperationBase<T extends IndexDefinition> = Omit<Types.Core_Bulk.OperationBase, '_index'> & {
|
|
91
89
|
_index?: T['index'];
|
|
92
90
|
};
|
|
93
91
|
type OperationContainer<T extends IndexDefinition> = {
|
|
@@ -96,154 +94,149 @@ type OperationContainer<T extends IndexDefinition> = {
|
|
|
96
94
|
index?: IndexOperation<T>;
|
|
97
95
|
update?: UpdateOperation<T>;
|
|
98
96
|
};
|
|
99
|
-
type UpdateAction<T extends IndexDefinition> = Omit<Core_Bulk.UpdateAction, 'doc' | 'upsert'> & ({
|
|
97
|
+
type UpdateAction<T extends IndexDefinition> = Omit<Types.Core_Bulk.UpdateAction, 'doc' | 'upsert'> & ({
|
|
100
98
|
doc: DeepPartial<DocumentFor<T>>;
|
|
101
99
|
upsert?: DocumentFor<T>;
|
|
102
100
|
} | {
|
|
103
101
|
doc?: DeepPartial<DocumentFor<T>>;
|
|
104
102
|
upsert: DocumentFor<T>;
|
|
105
103
|
});
|
|
106
|
-
type BulkRequest<T extends IndexDefinition> = Omit<Bulk_Request, 'index' | 'body' | '_source_excludes' | '_source_includes'> & {
|
|
104
|
+
type BulkRequest<T extends IndexDefinition> = Omit<API.Bulk_Request, 'index' | 'body' | '_source_excludes' | '_source_includes'> & {
|
|
107
105
|
index: T['index'];
|
|
108
106
|
body: BulkRequestBody<T>;
|
|
109
|
-
_source_excludes?: NestedLeafPaths<T> | Common
|
|
110
|
-
_source_includes?: NestedLeafPaths<T> | Common
|
|
107
|
+
_source_excludes?: NestedLeafPaths<T> | Types.Common.Fields;
|
|
108
|
+
_source_includes?: NestedLeafPaths<T> | Types.Common.Fields;
|
|
111
109
|
};
|
|
112
110
|
type BulkRequestBody<T extends IndexDefinition> = (OperationContainer<T> | UpdateAction<T> | DocumentFor<T>)[];
|
|
113
|
-
type ResponseItem<T extends IndexDefinition> = Omit<Core_Bulk.ResponseItem, '_index'> & {
|
|
111
|
+
type ResponseItem<T extends IndexDefinition> = Omit<Types.Core_Bulk.ResponseItem, '_index'> & {
|
|
114
112
|
_index: T['index'];
|
|
115
113
|
};
|
|
116
114
|
type CustomOperation = string;
|
|
117
115
|
type BulkOperation = 'index' | 'update' | 'delete' | 'create' | CustomOperation;
|
|
118
|
-
type BulkResponseBody<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'items'> & {
|
|
116
|
+
type BulkResponseBody<T extends IndexDefinition> = Omit<API.Bulk_ResponseBody, 'items'> & {
|
|
119
117
|
items: Record<BulkOperation, ResponseItem<T>>[];
|
|
120
118
|
};
|
|
121
|
-
type BulkResponse<T extends IndexDefinition> = Omit<Bulk_ResponseBody, 'body'> & {
|
|
119
|
+
type BulkResponse<T extends IndexDefinition> = Omit<API.Bulk_ResponseBody, 'body'> & {
|
|
122
120
|
body: BulkResponseBody<T>;
|
|
123
121
|
};
|
|
124
122
|
|
|
125
|
-
type BoolQuery<T> = Omit<Common_QueryDsl.BoolQuery, 'must' | 'should' | 'filter' | 'must_not'> & {
|
|
123
|
+
type BoolQuery<T> = Omit<Types.Common_QueryDsl.BoolQuery, 'must' | 'should' | 'filter' | 'must_not'> & {
|
|
126
124
|
must?: QueryContainer<T>[];
|
|
127
125
|
should?: QueryContainer<T>[];
|
|
128
126
|
filter?: QueryContainer<T>[];
|
|
129
127
|
must_not?: QueryContainer<T>[];
|
|
130
128
|
};
|
|
131
|
-
type BoostingQuery<T> = Omit<Common_QueryDsl.BoostingQuery, 'positive' | 'negative'> & {
|
|
129
|
+
type BoostingQuery<T> = Omit<Types.Common_QueryDsl.BoostingQuery, 'positive' | 'negative'> & {
|
|
132
130
|
positive: QueryContainer<T>;
|
|
133
131
|
negative: QueryContainer<T>;
|
|
134
132
|
};
|
|
135
|
-
type CombinedFieldsQuery<T> = Omit<Common_QueryDsl.CombinedFieldsQuery, 'fields'> & {
|
|
133
|
+
type CombinedFieldsQuery<T> = Omit<Types.Common_QueryDsl.CombinedFieldsQuery, 'fields'> & {
|
|
136
134
|
fields: NestedPaths<T>[];
|
|
137
135
|
};
|
|
138
|
-
type CommonTermsQuery = Common_QueryDsl.CommonTermsQuery;
|
|
139
|
-
type ConstantScoreQuery<T> = Omit<Common_QueryDsl.ConstantScoreQuery, 'filter'> & {
|
|
136
|
+
type CommonTermsQuery = Types.Common_QueryDsl.CommonTermsQuery;
|
|
137
|
+
type ConstantScoreQuery<T> = Omit<Types.Common_QueryDsl.ConstantScoreQuery, 'filter'> & {
|
|
140
138
|
filter: QueryContainer<T>;
|
|
141
139
|
};
|
|
142
|
-
type
|
|
143
|
-
type
|
|
144
|
-
type
|
|
145
|
-
type DecayFunction = Common_QueryDsl.DecayFunction;
|
|
146
|
-
type DecayFunctionBase = Common_QueryDsl.DecayFunctionBase;
|
|
147
|
-
type DisMaxQuery<T> = Omit<Common_QueryDsl.DisMaxQuery, 'queries'> & {
|
|
140
|
+
type DecayFunction = Types.Common_QueryDsl.DecayFunction;
|
|
141
|
+
type DecayFunctionBase = Types.Common_QueryDsl.DecayFunctionBase;
|
|
142
|
+
type DisMaxQuery<T> = Omit<Types.Common_QueryDsl.DisMaxQuery, 'queries'> & {
|
|
148
143
|
queries: QueryContainer<T>[];
|
|
149
144
|
};
|
|
150
|
-
type DistanceFeatureQuery<T> = Omit<Common_QueryDsl.DistanceFeatureQuery, 'field'> & {
|
|
145
|
+
type DistanceFeatureQuery<T> = Omit<Types.Common_QueryDsl.DistanceFeatureQuery, 'field'> & {
|
|
151
146
|
field: NestedPaths<T>;
|
|
152
147
|
};
|
|
153
|
-
type ExistsQuery<T> = Omit<Common_QueryDsl.ExistsQuery, 'field'> & {
|
|
148
|
+
type ExistsQuery<T> = Omit<Types.Common_QueryDsl.ExistsQuery, 'field'> & {
|
|
154
149
|
field: NestedPaths<T>;
|
|
155
150
|
};
|
|
156
|
-
type FieldAndFormat<T> = Omit<Common_QueryDsl.FieldAndFormat, 'field'> & {
|
|
151
|
+
type FieldAndFormat<T> = Omit<Types.Common_QueryDsl.FieldAndFormat, 'field'> & {
|
|
157
152
|
field: NestedPaths<T>;
|
|
158
153
|
};
|
|
159
154
|
type FieldQuery<T, K> = Partial<Record<NestedLeafPaths<T> | BuiltinKeys, K>>;
|
|
160
|
-
type FieldValueFactorScoreFunction<T> = Omit<Common_QueryDsl.FieldValueFactorScoreFunction, 'field'> & {
|
|
155
|
+
type FieldValueFactorScoreFunction<T> = Omit<Types.Common_QueryDsl.FieldValueFactorScoreFunction, 'field'> & {
|
|
161
156
|
field: NestedPaths<T>;
|
|
162
157
|
};
|
|
163
|
-
type FunctionBoostMode = Common_QueryDsl.FunctionBoostMode;
|
|
164
|
-
type FunctionScoreQuery<T> = Omit<Common_QueryDsl.FunctionScoreQuery, 'query'> & {
|
|
158
|
+
type FunctionBoostMode = Types.Common_QueryDsl.FunctionBoostMode;
|
|
159
|
+
type FunctionScoreQuery<T> = Omit<Types.Common_QueryDsl.FunctionScoreQuery, 'query'> & {
|
|
165
160
|
query?: QueryContainer<T> | undefined;
|
|
166
161
|
};
|
|
167
|
-
type FuzzyQuery = Common_QueryDsl.FuzzyQuery;
|
|
168
|
-
type GeoBoundingBoxQuery = Common_QueryDsl.GeoBoundingBoxQuery;
|
|
169
|
-
type
|
|
170
|
-
type
|
|
171
|
-
type
|
|
172
|
-
type GeoExecution = Common_QueryDsl.GeoExecution;
|
|
173
|
-
type GeoPolygonQuery<T> = Omit<Common_QueryDsl.GeoPolygonQuery, 'field'> & {
|
|
162
|
+
type FuzzyQuery = Types.Common_QueryDsl.FuzzyQuery;
|
|
163
|
+
type GeoBoundingBoxQuery = Types.Common_QueryDsl.GeoBoundingBoxQuery;
|
|
164
|
+
type GeoDistanceQuery = Types.Common_QueryDsl.GeoDistanceQuery;
|
|
165
|
+
type GeoExecution = Types.Common_QueryDsl.GeoExecution;
|
|
166
|
+
type GeoPolygonQuery<T> = Omit<Types.Common_QueryDsl.GeoPolygonQuery, 'field'> & {
|
|
174
167
|
field: NestedPaths<T>;
|
|
175
168
|
};
|
|
176
|
-
type GeoShapeQuery<T> = Omit<Common_QueryDsl.GeoShapeQuery, 'ignore_unmapped' | 'field'> & {
|
|
169
|
+
type GeoShapeQuery<T> = Omit<Types.Common_QueryDsl.GeoShapeQuery, 'ignore_unmapped' | 'field'> & {
|
|
177
170
|
field: NestedPaths<T>;
|
|
178
171
|
};
|
|
179
|
-
type GeoValidationMethod = Common_QueryDsl.GeoValidationMethod;
|
|
180
|
-
type HasChildQuery<T> = Omit<Common_QueryDsl.HasChildQuery, 'query'> & {
|
|
172
|
+
type GeoValidationMethod = Types.Common_QueryDsl.GeoValidationMethod;
|
|
173
|
+
type HasChildQuery<T> = Omit<Types.Common_QueryDsl.HasChildQuery, 'query'> & {
|
|
181
174
|
query: QueryContainer<T>;
|
|
182
175
|
};
|
|
183
|
-
type HasParentQuery<T> = Omit<Common_QueryDsl.HasParentQuery, 'query'> & {
|
|
176
|
+
type HasParentQuery<T> = Omit<Types.Common_QueryDsl.HasParentQuery, 'query'> & {
|
|
184
177
|
query: QueryContainer<T>;
|
|
185
178
|
};
|
|
186
|
-
type HybridQuery<T> = Omit<Common_QueryDsl.HybridQuery, 'queries'> & {
|
|
179
|
+
type HybridQuery<T> = Omit<Types.Common_QueryDsl.HybridQuery, 'queries'> & {
|
|
187
180
|
queries?: QueryContainer<T>[];
|
|
188
181
|
};
|
|
189
|
-
type IdsQuery = Common_QueryDsl.IdsQuery;
|
|
190
|
-
type IntervalsQuery = Common_QueryDsl.IntervalsQuery;
|
|
191
|
-
type KnnQuery<T> = Omit<Common_QueryDsl.KnnQuery, 'filter'> & {
|
|
182
|
+
type IdsQuery = Types.Common_QueryDsl.IdsQuery;
|
|
183
|
+
type IntervalsQuery = Types.Common_QueryDsl.IntervalsQuery;
|
|
184
|
+
type KnnQuery<T> = Omit<Types.Common_QueryDsl.KnnQuery, 'filter'> & {
|
|
192
185
|
filter?: QueryContainer<T>[];
|
|
193
186
|
};
|
|
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'> & {
|
|
187
|
+
type Like = Types.Common_QueryDsl.Like;
|
|
188
|
+
type LikeDocument = Types.Common_QueryDsl.LikeDocument;
|
|
189
|
+
type MatchAllQuery = Types.Common_QueryDsl.MatchAllQuery;
|
|
190
|
+
type MatchBoolPrefixQuery<T> = Omit<Types.Common_QueryDsl.MatchBoolPrefixQuery, 'query' | 'fields'> & {
|
|
198
191
|
fields: NestedPaths<T>[];
|
|
199
192
|
query: string;
|
|
200
193
|
};
|
|
201
|
-
type MatchNoneQuery = Common_QueryDsl.MatchNoneQuery;
|
|
202
|
-
type MatchPhrasePrefixQuery<T> = Omit<Common_QueryDsl.MatchPhrasePrefixQuery, 'query' | 'field'> & {
|
|
194
|
+
type MatchNoneQuery = Types.Common_QueryDsl.MatchNoneQuery;
|
|
195
|
+
type MatchPhrasePrefixQuery<T> = Omit<Types.Common_QueryDsl.MatchPhrasePrefixQuery, 'query' | 'field'> & {
|
|
203
196
|
field: NestedPaths<T>;
|
|
204
197
|
query: string;
|
|
205
198
|
};
|
|
206
|
-
type MatchPhraseQuery<T> = Omit<Common_QueryDsl.MatchPhraseQuery, 'query' | 'field'> & {
|
|
199
|
+
type MatchPhraseQuery<T> = Omit<Types.Common_QueryDsl.MatchPhraseQuery, 'query' | 'field'> & {
|
|
207
200
|
field: NestedPaths<T>;
|
|
208
201
|
query: string;
|
|
209
202
|
};
|
|
210
|
-
type MatchQuery = FieldValue | Common_QueryDsl.MatchQuery;
|
|
211
|
-
type MoreLikeThisQuery<T> = Omit<Common_QueryDsl.MoreLikeThisQuery, 'fields'> & {
|
|
203
|
+
type MatchQuery = FieldValue | Types.Common_QueryDsl.MatchQuery;
|
|
204
|
+
type MoreLikeThisQuery<T> = Omit<Types.Common_QueryDsl.MoreLikeThisQuery, 'fields'> & {
|
|
212
205
|
fields?: NestedPaths<T>[];
|
|
213
206
|
};
|
|
214
|
-
type MultiMatchQuery<T> = Omit<Common_QueryDsl.MultiMatchQuery, 'fields'> & {
|
|
207
|
+
type MultiMatchQuery<T> = Omit<Types.Common_QueryDsl.MultiMatchQuery, 'fields'> & {
|
|
215
208
|
fields?: NestedPaths<T>[];
|
|
216
209
|
};
|
|
217
|
-
type NestedQuery<T> = Omit<Common_QueryDsl.NestedQuery, 'query' | 'path'> & {
|
|
210
|
+
type NestedQuery<T> = Omit<Types.Common_QueryDsl.NestedQuery, 'query' | 'path'> & {
|
|
218
211
|
path: NestedPaths<T>;
|
|
219
212
|
query: QueryContainer<T>;
|
|
220
213
|
};
|
|
221
|
-
type NeuralQuery<T> = Omit<Common_QueryDsl.NeuralQuery, 'filter'> & {
|
|
214
|
+
type NeuralQuery<T> = Omit<Types.Common_QueryDsl.NeuralQuery, 'filter'> & {
|
|
222
215
|
filter?: QueryContainer<T>;
|
|
223
216
|
};
|
|
224
|
-
type
|
|
217
|
+
type NumberRangeQueryParameters<T> = Omit<Types.Common_QueryDsl.NumberRangeQueryParameters, 'field'> & {
|
|
225
218
|
field: NestedPaths<T>;
|
|
226
219
|
};
|
|
227
|
-
type ParentIdQuery = Common_QueryDsl.ParentIdQuery;
|
|
228
|
-
type PercolateQuery<T> = Omit<Common_QueryDsl.PercolateQuery, 'field'> & {
|
|
220
|
+
type ParentIdQuery = Types.Common_QueryDsl.ParentIdQuery;
|
|
221
|
+
type PercolateQuery<T> = Omit<Types.Common_QueryDsl.PercolateQuery, 'field'> & {
|
|
229
222
|
field: NestedPaths<T>;
|
|
230
223
|
};
|
|
231
|
-
type PinnedQuery = Common_QueryDsl.PinnedQuery;
|
|
232
|
-
type PrefixQuery<T> = Omit<Common_QueryDsl.PrefixQuery, 'value' | 'field'> & {
|
|
224
|
+
type PinnedQuery = Types.Common_QueryDsl.PinnedQuery;
|
|
225
|
+
type PrefixQuery<T> = Omit<Types.Common_QueryDsl.PrefixQuery, 'value' | 'field'> & {
|
|
233
226
|
field: NestedPaths<T>;
|
|
234
227
|
value: MapOpenSearchTypes<T>;
|
|
235
228
|
};
|
|
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'> & {
|
|
229
|
+
type QueryContainer<T> = Omit<Types.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
230
|
bool?: BoolQuery<T>;
|
|
238
231
|
boosting?: BoostingQuery<T>;
|
|
239
232
|
combined_fields?: CombinedFieldsQuery<T>;
|
|
240
|
-
common?: FieldQuery<T, Common_QueryDsl.CommonTermsQuery>;
|
|
233
|
+
common?: FieldQuery<T, Types.Common_QueryDsl.CommonTermsQuery>;
|
|
241
234
|
constant_score?: ConstantScoreQuery<T>;
|
|
242
235
|
dis_max?: DisMaxQuery<T>;
|
|
243
236
|
distance_feature?: DistanceFeatureQuery<T>;
|
|
244
237
|
exists?: ExistsQuery<T>;
|
|
245
238
|
function_score?: FunctionScoreQuery<T>;
|
|
246
|
-
fuzzy?: FieldQuery<T, Common_QueryDsl.FuzzyQuery>;
|
|
239
|
+
fuzzy?: FieldQuery<T, Types.Common_QueryDsl.FuzzyQuery>;
|
|
247
240
|
geo_bounding_box?: GeoBoundingBoxQuery;
|
|
248
241
|
geo_distance?: GeoDistanceQuery;
|
|
249
242
|
geo_polygon?: GeoPolygonQuery<T>;
|
|
@@ -291,23 +284,23 @@ type QueryContainer<T> = Omit<Common_QueryDsl.QueryContainer, 'bool' | 'boosting
|
|
|
291
284
|
wrapper?: WrapperQuery;
|
|
292
285
|
xy_shape?: XyShapeQuery<T>;
|
|
293
286
|
};
|
|
294
|
-
type QueryStringQuery = Common_QueryDsl.QueryStringQuery;
|
|
295
|
-
type RangeQuery<T> = Omit<Common_QueryDsl.RangeQuery, 'field'> & {
|
|
287
|
+
type QueryStringQuery = Types.Common_QueryDsl.QueryStringQuery;
|
|
288
|
+
type RangeQuery<T> = Omit<Types.Common_QueryDsl.RangeQuery, 'field'> & {
|
|
296
289
|
field: NestedPaths<T>;
|
|
297
290
|
};
|
|
298
|
-
type RankFeatureQuery = Common_QueryDsl.RankFeatureQuery;
|
|
299
|
-
type RegexpQuery<T> = Omit<Common_QueryDsl.RegexpQuery, 'value' | 'field'> & {
|
|
291
|
+
type RankFeatureQuery = Types.Common_QueryDsl.RankFeatureQuery;
|
|
292
|
+
type RegexpQuery<T> = Omit<Types.Common_QueryDsl.RegexpQuery, 'value' | 'field'> & {
|
|
300
293
|
field: NestedPaths<T>;
|
|
301
294
|
value: MapOpenSearchTypes<T>;
|
|
302
295
|
};
|
|
303
|
-
type ScriptQuery = Common_QueryDsl.ScriptQuery;
|
|
304
|
-
type ScriptScoreQuery<T> = Omit<Common_QueryDsl.ScriptScoreQuery, 'query'> & {
|
|
296
|
+
type ScriptQuery = Types.Common_QueryDsl.ScriptQuery;
|
|
297
|
+
type ScriptScoreQuery<T> = Omit<Types.Common_QueryDsl.ScriptScoreQuery, 'query'> & {
|
|
305
298
|
query?: QueryContainer<T>;
|
|
306
299
|
};
|
|
307
|
-
type SimpleQueryStringQuery<T> = Omit<Common_QueryDsl.SimpleQueryStringQuery, 'fields'> & {
|
|
300
|
+
type SimpleQueryStringQuery<T> = Omit<Types.Common_QueryDsl.SimpleQueryStringQuery, 'fields'> & {
|
|
308
301
|
fields: NestedLeafPaths<T>[];
|
|
309
302
|
};
|
|
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'> & {
|
|
303
|
+
type SpanQuery<T> = Omit<Types.Common_QueryDsl.SpanQuery, 'field_masking_span' | 'span_containing' | 'span_first' | 'span_multi' | 'span_near' | 'span_not' | 'span_or' | 'span_term' | 'span_within'> & {
|
|
311
304
|
field_masking_span?: SpanFieldMaskingQuery<T>;
|
|
312
305
|
span_containing?: SpanContainingQuery<T>;
|
|
313
306
|
span_first?: SpanFirstQuery<T>;
|
|
@@ -318,70 +311,70 @@ type SpanQuery<T> = Omit<Common_QueryDsl.SpanQuery, 'field_masking_span' | 'span
|
|
|
318
311
|
span_term?: Record<NestedPaths<T>, SpanTermQuery<T>>;
|
|
319
312
|
span_within?: SpanWithinQuery<T>;
|
|
320
313
|
};
|
|
321
|
-
type SpanContainingQuery<T> = Omit<Common_QueryDsl.SpanContainingQuery, 'big' | 'little'> & {
|
|
314
|
+
type SpanContainingQuery<T> = Omit<Types.Common_QueryDsl.SpanContainingQuery, 'big' | 'little'> & {
|
|
322
315
|
big: SpanQuery<T>;
|
|
323
316
|
little: SpanQuery<T>;
|
|
324
317
|
};
|
|
325
|
-
type SpanFieldMaskingQuery<T> = Omit<Common_QueryDsl.SpanFieldMaskingQuery, 'field' | 'query'> & {
|
|
318
|
+
type SpanFieldMaskingQuery<T> = Omit<Types.Common_QueryDsl.SpanFieldMaskingQuery, 'field' | 'query'> & {
|
|
326
319
|
field: NestedPaths<T>;
|
|
327
320
|
query: SpanQuery<T>;
|
|
328
321
|
};
|
|
329
|
-
type SpanFirstQuery<T> = Omit<Common_QueryDsl.SpanFirstQuery, 'match'> & {
|
|
322
|
+
type SpanFirstQuery<T> = Omit<Types.Common_QueryDsl.SpanFirstQuery, 'match'> & {
|
|
330
323
|
match: SpanQuery<T>;
|
|
331
324
|
};
|
|
332
|
-
type SpanMultiTermQuery<T> = Omit<Common_QueryDsl.SpanMultiTermQuery, 'match'> & {
|
|
325
|
+
type SpanMultiTermQuery<T> = Omit<Types.Common_QueryDsl.SpanMultiTermQuery, 'match'> & {
|
|
333
326
|
match: QueryContainer<T>;
|
|
334
327
|
};
|
|
335
|
-
type SpanNearQuery<T> = Omit<Common_QueryDsl.SpanNearQuery, 'clauses'> & {
|
|
328
|
+
type SpanNearQuery<T> = Omit<Types.Common_QueryDsl.SpanNearQuery, 'clauses'> & {
|
|
336
329
|
clauses: SpanQuery<T>[];
|
|
337
330
|
};
|
|
338
|
-
type SpanNotQuery<T> = Omit<Common_QueryDsl.SpanNotQuery, 'include' | 'exclude'> & {
|
|
331
|
+
type SpanNotQuery<T> = Omit<Types.Common_QueryDsl.SpanNotQuery, 'include' | 'exclude'> & {
|
|
339
332
|
include: SpanQuery<T>;
|
|
340
333
|
exclude: SpanQuery<T>;
|
|
341
334
|
};
|
|
342
|
-
type SpanOrQuery<T> = Omit<Common_QueryDsl.SpanOrQuery, 'clauses'> & {
|
|
335
|
+
type SpanOrQuery<T> = Omit<Types.Common_QueryDsl.SpanOrQuery, 'clauses'> & {
|
|
343
336
|
clauses: SpanQuery<T>[];
|
|
344
337
|
};
|
|
345
|
-
type SpanTermQuery<T> = Omit<Common_QueryDsl.SpanTermQuery, 'value' | 'field'> & {
|
|
338
|
+
type SpanTermQuery<T> = Omit<Types.Common_QueryDsl.SpanTermQuery, 'value' | 'field'> & {
|
|
346
339
|
field: NestedPaths<T>;
|
|
347
340
|
value: MapOpenSearchTypes<T>;
|
|
348
341
|
};
|
|
349
|
-
type SpanWithinQuery<T> = Omit<Common_QueryDsl.SpanWithinQuery, 'big' | 'little'> & {
|
|
342
|
+
type SpanWithinQuery<T> = Omit<Types.Common_QueryDsl.SpanWithinQuery, 'big' | 'little'> & {
|
|
350
343
|
big: SpanQuery<T>;
|
|
351
344
|
little: SpanQuery<T>;
|
|
352
345
|
};
|
|
353
|
-
type TermQuery<T> = Omit<Common_QueryDsl.TermQuery, 'value' | 'field'> & {
|
|
346
|
+
type TermQuery<T> = Omit<Types.Common_QueryDsl.TermQuery, 'value' | 'field'> & {
|
|
354
347
|
field: NestedPaths<T>;
|
|
355
348
|
value: MapOpenSearchTypes<T>;
|
|
356
349
|
};
|
|
357
|
-
type TermsQuery<T> = Omit<Common_QueryDsl.TermsQuery, 'terms' | 'field'> & {
|
|
350
|
+
type TermsQuery<T> = Omit<Types.Common_QueryDsl.TermsQuery, 'terms' | 'field'> & {
|
|
358
351
|
field: NestedPaths<T>;
|
|
359
352
|
terms: FieldValue[];
|
|
360
353
|
};
|
|
361
|
-
type TermsSetQuery<T> = Omit<Common_QueryDsl.TermsSetQuery, 'terms' | 'field'> & {
|
|
354
|
+
type TermsSetQuery<T> = Omit<Types.Common_QueryDsl.TermsSetQuery, 'terms' | 'field'> & {
|
|
362
355
|
field: NestedPaths<T>;
|
|
363
356
|
terms: FieldValue[];
|
|
364
357
|
};
|
|
365
|
-
type TypeQuery = Common_QueryDsl.TypeQuery;
|
|
366
|
-
type WildcardQuery<T> = Omit<Common_QueryDsl.WildcardQuery, 'value' | 'field'> & {
|
|
358
|
+
type TypeQuery = Types.Common_QueryDsl.TypeQuery;
|
|
359
|
+
type WildcardQuery<T> = Omit<Types.Common_QueryDsl.WildcardQuery, 'value' | 'field'> & {
|
|
367
360
|
field: NestedPaths<T>;
|
|
368
361
|
value: MapOpenSearchTypes<T>;
|
|
369
362
|
};
|
|
370
|
-
type WrapperQuery = Common_QueryDsl.WrapperQuery;
|
|
371
|
-
type XyShapeQuery<T> = Omit<Common_QueryDsl.XyShapeQuery, 'field'> & {
|
|
363
|
+
type WrapperQuery = Types.Common_QueryDsl.WrapperQuery;
|
|
364
|
+
type XyShapeQuery<T> = Omit<Types.Common_QueryDsl.XyShapeQuery, 'field'> & {
|
|
372
365
|
field: NestedPaths<T>;
|
|
373
366
|
};
|
|
374
367
|
|
|
375
|
-
type FieldCollapse<T> = Omit<
|
|
368
|
+
type FieldCollapse<T> = Omit<Types.Core_Search.FieldCollapse, 'field'> & {
|
|
376
369
|
field: NestedPaths<T>;
|
|
377
370
|
};
|
|
378
|
-
type Highlight<T> = Omit<
|
|
379
|
-
fields: FieldQuery<T,
|
|
371
|
+
type Highlight<T> = Omit<Types.Core_Search.Highlight, 'fields'> & {
|
|
372
|
+
fields: FieldQuery<T, Types.Core_Search.HighlightField>;
|
|
380
373
|
};
|
|
381
|
-
type Hit<T extends IndexDefinition> = Omit<
|
|
374
|
+
type Hit<T extends IndexDefinition> = Omit<Types.Core_Search.Hit, '_source'> & {
|
|
382
375
|
_source: DocumentFor<T>;
|
|
383
376
|
};
|
|
384
|
-
type HitsMetadata<T extends IndexDefinition> = Omit<
|
|
377
|
+
type HitsMetadata<T extends IndexDefinition> = Omit<Types.Core_Search.HitsMetadata, 'hits'> & {
|
|
385
378
|
hits: Hit<T>[];
|
|
386
379
|
};
|
|
387
380
|
type SourceConfig<T> = boolean | SourceFilter<T>;
|
|
@@ -390,25 +383,25 @@ type SourceFilter<T> = NestedPaths<T>[] | {
|
|
|
390
383
|
includes?: NestedPaths<T>[];
|
|
391
384
|
};
|
|
392
385
|
|
|
393
|
-
type SearchRequest<T extends IndexDefinition> = Omit<Search_Request, 'body' | 'index'> & {
|
|
386
|
+
type SearchRequest<T extends IndexDefinition> = Omit<API.Search_Request, 'body' | 'index'> & {
|
|
394
387
|
index: T['index'];
|
|
395
388
|
body: SearchRequestBody<T>;
|
|
396
389
|
};
|
|
397
|
-
type SearchRequestBody<T extends IndexDefinition> = Omit<Search_RequestBody, 'query' | 'collapse' | 'highlight' | 'sort' | '_source'> & {
|
|
390
|
+
type SearchRequestBody<T extends IndexDefinition> = Omit<API.Search_RequestBody, 'query' | 'collapse' | 'highlight' | 'sort' | '_source'> & {
|
|
398
391
|
query?: QueryContainer<MapQueryProperties<T>>;
|
|
399
392
|
collapse?: FieldCollapse<MapQueryProperties<T>>;
|
|
400
393
|
highlight?: Highlight<MapQueryProperties<T>>;
|
|
401
394
|
sort?: Sort<MapQueryProperties<T>>;
|
|
402
395
|
_source?: SourceConfig<MapQueryProperties<T>>;
|
|
403
396
|
};
|
|
404
|
-
type SearchResponse<T extends IndexDefinition> = Omit<Search_Response, 'body'> & {
|
|
397
|
+
type SearchResponse<T extends IndexDefinition> = Omit<API.Search_Response, 'body'> & {
|
|
405
398
|
body: SearchResponseBody<T>;
|
|
406
399
|
};
|
|
407
|
-
type SearchResponseBody<T extends IndexDefinition> = Omit<Search_ResponseBody, 'hits'> & {
|
|
400
|
+
type SearchResponseBody<T extends IndexDefinition> = Omit<API.Search_ResponseBody, 'hits'> & {
|
|
408
401
|
hits: HitsMetadata<T>;
|
|
409
402
|
};
|
|
410
403
|
|
|
411
|
-
interface IndexRequest<T> extends Omit<Index_Request, 'body' | 'index'> {
|
|
404
|
+
interface IndexRequest<T> extends Omit<API.Index_Request, 'body' | 'index'> {
|
|
412
405
|
index: T extends {
|
|
413
406
|
index: infer I;
|
|
414
407
|
} ? I : never;
|
|
@@ -420,14 +413,14 @@ interface IndexRequest<T> extends Omit<Index_Request, 'body' | 'index'> {
|
|
|
420
413
|
};
|
|
421
414
|
} ? MapOpenSearchTypes<P> : never;
|
|
422
415
|
}
|
|
423
|
-
interface IndexResponse extends Index_Response {
|
|
416
|
+
interface IndexResponse extends API.Index_Response {
|
|
424
417
|
}
|
|
425
|
-
type IndicesExistsRequest<T extends IndexDefinition> = Omit<Indices_Exists_Request, 'index'> & {
|
|
418
|
+
type IndicesExistsRequest<T extends IndexDefinition> = Omit<API.Indices_Exists_Request, 'index'> & {
|
|
426
419
|
index: Extract<T['index'], string>;
|
|
427
420
|
};
|
|
428
421
|
|
|
429
422
|
type TypedIndices = Omit<Indices, 'exists'> & {
|
|
430
|
-
exists<T extends IndexDefinition>(params: IndicesExistsRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<Indices_Exists_Response>;
|
|
423
|
+
exists<T extends IndexDefinition>(params: IndicesExistsRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<API.Indices_Exists_Response>;
|
|
431
424
|
};
|
|
432
425
|
/**
|
|
433
426
|
* ✅ Constructor type that ensures `new OpenSearchClient()` works.
|
|
@@ -441,7 +434,7 @@ type OpenSearchClientConstructor = new (...args: ConstructorParameters<typeof Cl
|
|
|
441
434
|
*/
|
|
442
435
|
interface OpenSearchClient extends Omit<Client, 'search' | 'index' | 'bulk' | 'indices'> {
|
|
443
436
|
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>;
|
|
437
|
+
index<T extends IndexDefinition>(params: IndexRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<API.Index_Response>;
|
|
445
438
|
bulk<T extends IndexDefinition>(params: BulkRequest<T>, options?: TransportRequestOptions): TransportRequestPromise<BulkResponse<T>>;
|
|
446
439
|
indices: TypedIndices;
|
|
447
440
|
}
|
|
@@ -453,7 +446,7 @@ interface OpenSearchClient extends Omit<Client, 'search' | 'index' | 'bulk' | 'i
|
|
|
453
446
|
*/
|
|
454
447
|
declare const OpenSearchClient: OpenSearchClientConstructor;
|
|
455
448
|
|
|
456
|
-
type IdFunction<T extends IndexDefinition> = (doc: DocumentFor<T>) => Common
|
|
449
|
+
type IdFunction<T extends IndexDefinition> = (doc: DocumentFor<T>) => Types.Common.Id;
|
|
457
450
|
/**
|
|
458
451
|
* Constructs a bulk request payload for indexing documents.
|
|
459
452
|
*
|
|
@@ -505,6 +498,6 @@ declare function bulkUpdate<T extends IndexDefinition>(index: T['index'], update
|
|
|
505
498
|
* @param idFn - A function that returns the _id for a given document.
|
|
506
499
|
* @returns A BulkRequest payload for delete operations.
|
|
507
500
|
*/
|
|
508
|
-
declare function bulkDelete<T extends IndexDefinition>(index: T['index'], ids: Common
|
|
501
|
+
declare function bulkDelete<T extends IndexDefinition>(index: T['index'], ids: Types.Common.Id[]): BulkRequest<T>;
|
|
509
502
|
|
|
510
|
-
export { type BoolQuery, type BoostingQuery, type BulkRequest, type BulkResponse, type CombinedFieldsQuery, type CommonTermsQuery, type ConstantScoreQuery, type
|
|
503
|
+
export { type BoolQuery, type BoostingQuery, type BulkRequest, type BulkResponse, type CombinedFieldsQuery, type CommonTermsQuery, type ConstantScoreQuery, 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 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 NumberRangeQueryParameters, 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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/opensearch",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"typecheck": "vitest --typecheck.only --passWithNoTests"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"testcontainers": "11.7.
|
|
20
|
+
"testcontainers": "11.7.2",
|
|
21
21
|
"tsconfig": "*"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@opensearch-project/opensearch": "3.
|
|
24
|
+
"@opensearch-project/opensearch": "3.5.1"
|
|
25
25
|
}
|
|
26
26
|
}
|