@azure/search-documents 11.3.0-beta.8 → 11.3.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/CHANGELOG.md +227 -0
- package/README.md +40 -18
- package/dist/index.js +961 -3443
- package/dist/index.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/generated/data/index.js +1 -1
- package/dist-esm/src/generated/data/index.js.map +1 -1
- package/dist-esm/src/generated/data/models/index.js +1 -202
- package/dist-esm/src/generated/data/models/index.js.map +1 -1
- package/dist-esm/src/generated/data/models/mappers.js +1 -138
- package/dist-esm/src/generated/data/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/data/models/parameters.js +13 -72
- package/dist-esm/src/generated/data/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/data/operations/documents.js +51 -23
- package/dist-esm/src/generated/data/operations/documents.js.map +1 -1
- package/dist-esm/src/generated/data/searchClient.js +5 -33
- package/dist-esm/src/generated/data/searchClient.js.map +1 -1
- package/dist-esm/src/generated/data/searchClientContext.js +11 -13
- package/dist-esm/src/generated/data/searchClientContext.js.map +1 -1
- package/dist-esm/src/generated/service/index.js +1 -1
- package/dist-esm/src/generated/service/index.js.map +1 -1
- package/dist-esm/src/generated/service/models/index.js +1 -904
- package/dist-esm/src/generated/service/models/index.js.map +1 -1
- package/dist-esm/src/generated/service/models/mappers.js +25 -750
- package/dist-esm/src/generated/service/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/service/models/parameters.js +1 -51
- package/dist-esm/src/generated/service/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/service/operations/dataSources.js +30 -13
- package/dist-esm/src/generated/service/operations/dataSources.js.map +1 -1
- package/dist-esm/src/generated/service/operations/index.js +0 -1
- package/dist-esm/src/generated/service/operations/index.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexers.js +45 -45
- package/dist-esm/src/generated/service/operations/indexers.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexes.js +40 -11
- package/dist-esm/src/generated/service/operations/indexes.js.map +1 -1
- package/dist-esm/src/generated/service/operations/skillsets.js +30 -43
- package/dist-esm/src/generated/service/operations/skillsets.js.map +1 -1
- package/dist-esm/src/generated/service/operations/synonymMaps.js +29 -9
- package/dist-esm/src/generated/service/operations/synonymMaps.js.map +1 -1
- package/dist-esm/src/generated/service/searchServiceClient.js +15 -37
- package/dist-esm/src/generated/service/searchServiceClient.js.map +1 -1
- package/dist-esm/src/generated/service/searchServiceClientContext.js +11 -13
- package/dist-esm/src/generated/service/searchServiceClientContext.js.map +1 -1
- package/dist-esm/src/geographyPoint.js +1 -1
- package/dist-esm/src/geographyPoint.js.map +1 -1
- package/dist-esm/src/index.js +2 -4
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/indexDocumentsBatch.js +1 -1
- package/dist-esm/src/indexDocumentsBatch.js.map +1 -1
- package/dist-esm/src/indexModels.js.map +1 -1
- package/dist-esm/src/odataMetadataPolicy.js +15 -7
- package/dist-esm/src/odataMetadataPolicy.js.map +1 -1
- package/dist-esm/src/searchApiKeyCredentialPolicy.js +21 -8
- package/dist-esm/src/searchApiKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/searchAudience.js.map +1 -1
- package/dist-esm/src/searchClient.js +67 -91
- package/dist-esm/src/searchClient.js.map +1 -1
- package/dist-esm/src/searchIndexClient.js +74 -236
- package/dist-esm/src/searchIndexClient.js.map +1 -1
- package/dist-esm/src/searchIndexerClient.js +86 -143
- package/dist-esm/src/searchIndexerClient.js.map +1 -1
- package/dist-esm/src/searchIndexingBufferedSender.js +17 -16
- package/dist-esm/src/searchIndexingBufferedSender.js.map +1 -1
- package/dist-esm/src/serialization.js +5 -5
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/serviceModels.js.map +1 -1
- package/dist-esm/src/serviceUtils.js +31 -68
- package/dist-esm/src/serviceUtils.js.map +1 -1
- package/dist-esm/src/synonymMapHelper.js +2 -6
- package/dist-esm/src/synonymMapHelper.js.map +1 -1
- package/dist-esm/src/tracing.js +5 -6
- package/dist-esm/src/tracing.js.map +1 -1
- package/package.json +44 -45
- package/types/search-documents.d.ts +162 -1150
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js +0 -9
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js.map +0 -1
- package/dist-esm/src/generated/data/operationsInterfaces/index.js +0 -9
- package/dist-esm/src/generated/data/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/src/generated/service/operations/aliases.js +0 -166
- package/dist-esm/src/generated/service/operations/aliases.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/aliases.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/aliases.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/index.js +0 -14
- package/dist-esm/src/generated/service/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js.map +0 -1
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js +0 -9
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await
|
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
4
|
/// <reference lib="esnext.asynciterable" />
|
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
|
-
import { bearerTokenAuthenticationPolicy } from "@azure/core-
|
|
6
|
+
import { createPipelineFromOptions, operationOptionsToRequestOptionsBase, bearerTokenAuthenticationPolicy } from "@azure/core-http";
|
|
7
|
+
import { SpanStatusCode } from "@azure/core-tracing";
|
|
7
8
|
import { SDK_VERSION } from "./constants";
|
|
8
9
|
import { SearchServiceClient as GeneratedClient } from "./generated/service/searchServiceClient";
|
|
9
10
|
import { logger } from "./logger";
|
|
10
11
|
import { createSearchApiKeyCredentialPolicy } from "./searchApiKeyCredentialPolicy";
|
|
11
12
|
import * as utils from "./serviceUtils";
|
|
12
13
|
import { createSpan } from "./tracing";
|
|
13
|
-
import {
|
|
14
|
+
import { odataMetadataPolicy } from "./odataMetadataPolicy";
|
|
14
15
|
import { SearchClient } from "./searchClient";
|
|
15
16
|
import { KnownSearchAudience } from "./searchAudience";
|
|
16
17
|
/**
|
|
@@ -39,12 +40,7 @@ export class SearchIndexClient {
|
|
|
39
40
|
/**
|
|
40
41
|
* The API version to use when communicating with the service.
|
|
41
42
|
*/
|
|
42
|
-
this.
|
|
43
|
-
/**
|
|
44
|
-
* The API version to use when communicating with the service.
|
|
45
|
-
* @deprecated use {@Link serviceVersion} instead
|
|
46
|
-
*/
|
|
47
|
-
this.apiVersion = utils.defaultServiceVersion;
|
|
43
|
+
this.apiVersion = "2020-06-30";
|
|
48
44
|
this.endpoint = endpoint;
|
|
49
45
|
this.credential = credential;
|
|
50
46
|
this.options = options;
|
|
@@ -58,57 +54,50 @@ export class SearchIndexClient {
|
|
|
58
54
|
else {
|
|
59
55
|
options.userAgentOptions.userAgentPrefix = libInfo;
|
|
60
56
|
}
|
|
61
|
-
const
|
|
57
|
+
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
62
58
|
loggingOptions: {
|
|
63
59
|
logger: logger.info,
|
|
64
|
-
|
|
60
|
+
allowedHeaderNames: [
|
|
65
61
|
"elapsed-time",
|
|
66
62
|
"Location",
|
|
67
63
|
"OData-MaxVersion",
|
|
68
64
|
"OData-Version",
|
|
69
65
|
"Prefer",
|
|
70
|
-
"throttle-reason"
|
|
71
|
-
]
|
|
72
|
-
}
|
|
66
|
+
"throttle-reason"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
73
69
|
});
|
|
70
|
+
const scope = options.audience
|
|
71
|
+
? `${options.audience}/.default`
|
|
72
|
+
: `${KnownSearchAudience.AzurePublicCloud}/.default`;
|
|
73
|
+
const requestPolicyFactory = isTokenCredential(credential)
|
|
74
|
+
? bearerTokenAuthenticationPolicy(credential, scope)
|
|
75
|
+
: createSearchApiKeyCredentialPolicy(credential);
|
|
76
|
+
const pipeline = createPipelineFromOptions(internalPipelineOptions, requestPolicyFactory);
|
|
77
|
+
if (Array.isArray(pipeline.requestPolicyFactories)) {
|
|
78
|
+
pipeline.requestPolicyFactories.unshift(odataMetadataPolicy("minimal"));
|
|
79
|
+
}
|
|
80
|
+
let apiVersion = this.apiVersion;
|
|
74
81
|
if (options.apiVersion) {
|
|
75
|
-
if (!
|
|
82
|
+
if (!["2020-06-30-Preview", "2020-06-30"].includes(options.apiVersion)) {
|
|
76
83
|
throw new Error(`Invalid Api Version: ${options.apiVersion}`);
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
this.apiVersion = options.apiVersion;
|
|
80
|
-
}
|
|
81
|
-
if (options.serviceVersion) {
|
|
82
|
-
if (!utils.serviceVersions.includes(options.serviceVersion)) {
|
|
83
|
-
throw new Error(`Invalid Service Version: ${options.serviceVersion}`);
|
|
84
|
-
}
|
|
85
|
-
this.serviceVersion = options.serviceVersion;
|
|
86
|
-
this.apiVersion = options.serviceVersion;
|
|
85
|
+
apiVersion = options.apiVersion;
|
|
87
86
|
}
|
|
88
|
-
this.client = new GeneratedClient(this.endpoint,
|
|
89
|
-
if (isTokenCredential(credential)) {
|
|
90
|
-
const scope = options.audience
|
|
91
|
-
? `${options.audience}/.default`
|
|
92
|
-
: `${KnownSearchAudience.AzurePublicCloud}/.default`;
|
|
93
|
-
this.client.pipeline.addPolicy(bearerTokenAuthenticationPolicy({ credential, scopes: scope }));
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
this.client.pipeline.addPolicy(createSearchApiKeyCredentialPolicy(credential));
|
|
97
|
-
}
|
|
98
|
-
this.client.pipeline.addPolicy(createOdataMetadataPolicy("minimal"));
|
|
87
|
+
this.client = new GeneratedClient(this.endpoint, apiVersion, pipeline);
|
|
99
88
|
}
|
|
100
89
|
listIndexesPage(options = {}) {
|
|
101
90
|
return __asyncGenerator(this, arguments, function* listIndexesPage_1() {
|
|
102
91
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesPage", options);
|
|
103
92
|
try {
|
|
104
|
-
const result = yield __await(this.client.indexes.list(updatedOptions));
|
|
93
|
+
const result = yield __await(this.client.indexes.list(operationOptionsToRequestOptionsBase(updatedOptions)));
|
|
105
94
|
const mapped = result.indexes.map(utils.generatedIndexToPublicIndex);
|
|
106
95
|
yield yield __await(mapped);
|
|
107
96
|
}
|
|
108
97
|
catch (e) {
|
|
109
98
|
span.setStatus({
|
|
110
|
-
|
|
111
|
-
|
|
99
|
+
code: SpanStatusCode.ERROR,
|
|
100
|
+
message: e.message
|
|
112
101
|
});
|
|
113
102
|
throw e;
|
|
114
103
|
}
|
|
@@ -150,76 +139,21 @@ export class SearchIndexClient {
|
|
|
150
139
|
},
|
|
151
140
|
byPage: () => {
|
|
152
141
|
return this.listIndexesPage(options);
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
listAliasesPage(options = {}) {
|
|
157
|
-
return __asyncGenerator(this, arguments, function* listAliasesPage_1() {
|
|
158
|
-
const { span, updatedOptions } = createSpan("SearchIndexerClient-listAliases", options);
|
|
159
|
-
try {
|
|
160
|
-
const result = yield __await(this.client.aliases.list(updatedOptions));
|
|
161
|
-
yield yield __await(result.aliases);
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
span.setStatus({
|
|
165
|
-
status: "error",
|
|
166
|
-
error: e.message,
|
|
167
|
-
});
|
|
168
|
-
throw e;
|
|
169
|
-
}
|
|
170
|
-
finally {
|
|
171
|
-
span.end();
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
listAliasesAll(options = {}) {
|
|
176
|
-
return __asyncGenerator(this, arguments, function* listAliasesAll_1() {
|
|
177
|
-
var e_2, _a;
|
|
178
|
-
try {
|
|
179
|
-
for (var _b = __asyncValues(this.listAliasesPage(options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
180
|
-
const page = _c.value;
|
|
181
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
185
|
-
finally {
|
|
186
|
-
try {
|
|
187
|
-
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
188
|
-
}
|
|
189
|
-
finally { if (e_2) throw e_2.error; }
|
|
190
142
|
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Lists all aliases available for a search service.
|
|
195
|
-
* @param options - The options parameters.
|
|
196
|
-
*/
|
|
197
|
-
listAliases(options = {}) {
|
|
198
|
-
const iter = this.listAliasesAll(options);
|
|
199
|
-
return {
|
|
200
|
-
next() {
|
|
201
|
-
return iter.next();
|
|
202
|
-
},
|
|
203
|
-
[Symbol.asyncIterator]() {
|
|
204
|
-
return this;
|
|
205
|
-
},
|
|
206
|
-
byPage: () => {
|
|
207
|
-
return this.listAliasesPage(options);
|
|
208
|
-
},
|
|
209
143
|
};
|
|
210
144
|
}
|
|
211
145
|
listIndexesNamesPage(options = {}) {
|
|
212
146
|
return __asyncGenerator(this, arguments, function* listIndexesNamesPage_1() {
|
|
213
147
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesNamesPage", options);
|
|
214
148
|
try {
|
|
215
|
-
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" })));
|
|
149
|
+
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { select: "name" })));
|
|
216
150
|
const mapped = result.indexes.map((idx) => idx.name);
|
|
217
151
|
yield yield __await(mapped);
|
|
218
152
|
}
|
|
219
153
|
catch (e) {
|
|
220
154
|
span.setStatus({
|
|
221
|
-
|
|
222
|
-
|
|
155
|
+
code: SpanStatusCode.ERROR,
|
|
156
|
+
message: e.message
|
|
223
157
|
});
|
|
224
158
|
throw e;
|
|
225
159
|
}
|
|
@@ -230,19 +164,19 @@ export class SearchIndexClient {
|
|
|
230
164
|
}
|
|
231
165
|
listIndexesNamesAll(options = {}) {
|
|
232
166
|
return __asyncGenerator(this, arguments, function* listIndexesNamesAll_1() {
|
|
233
|
-
var
|
|
167
|
+
var e_2, _a;
|
|
234
168
|
try {
|
|
235
169
|
for (var _b = __asyncValues(this.listIndexesNamesPage(options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
236
170
|
const page = _c.value;
|
|
237
171
|
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
238
172
|
}
|
|
239
173
|
}
|
|
240
|
-
catch (
|
|
174
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
241
175
|
finally {
|
|
242
176
|
try {
|
|
243
177
|
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
244
178
|
}
|
|
245
|
-
finally { if (
|
|
179
|
+
finally { if (e_2) throw e_2.error; }
|
|
246
180
|
}
|
|
247
181
|
});
|
|
248
182
|
}
|
|
@@ -261,7 +195,7 @@ export class SearchIndexClient {
|
|
|
261
195
|
},
|
|
262
196
|
byPage: () => {
|
|
263
197
|
return this.listIndexesNamesPage(options);
|
|
264
|
-
}
|
|
198
|
+
}
|
|
265
199
|
};
|
|
266
200
|
}
|
|
267
201
|
/**
|
|
@@ -271,13 +205,13 @@ export class SearchIndexClient {
|
|
|
271
205
|
async listSynonymMaps(options = {}) {
|
|
272
206
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMaps", options);
|
|
273
207
|
try {
|
|
274
|
-
const result = await this.client.synonymMaps.list(updatedOptions);
|
|
208
|
+
const result = await this.client.synonymMaps.list(operationOptionsToRequestOptionsBase(updatedOptions));
|
|
275
209
|
return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);
|
|
276
210
|
}
|
|
277
211
|
catch (e) {
|
|
278
212
|
span.setStatus({
|
|
279
|
-
|
|
280
|
-
|
|
213
|
+
code: SpanStatusCode.ERROR,
|
|
214
|
+
message: e.message
|
|
281
215
|
});
|
|
282
216
|
throw e;
|
|
283
217
|
}
|
|
@@ -292,13 +226,13 @@ export class SearchIndexClient {
|
|
|
292
226
|
async listSynonymMapsNames(options = {}) {
|
|
293
227
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMapsNames", options);
|
|
294
228
|
try {
|
|
295
|
-
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" }));
|
|
229
|
+
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { select: "name" }));
|
|
296
230
|
return result.synonymMaps.map((sm) => sm.name);
|
|
297
231
|
}
|
|
298
232
|
catch (e) {
|
|
299
233
|
span.setStatus({
|
|
300
|
-
|
|
301
|
-
|
|
234
|
+
code: SpanStatusCode.ERROR,
|
|
235
|
+
message: e.message
|
|
302
236
|
});
|
|
303
237
|
throw e;
|
|
304
238
|
}
|
|
@@ -314,13 +248,13 @@ export class SearchIndexClient {
|
|
|
314
248
|
async getIndex(indexName, options = {}) {
|
|
315
249
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndex", options);
|
|
316
250
|
try {
|
|
317
|
-
const result = await this.client.indexes.get(indexName, updatedOptions);
|
|
251
|
+
const result = await this.client.indexes.get(indexName, operationOptionsToRequestOptionsBase(updatedOptions));
|
|
318
252
|
return utils.generatedIndexToPublicIndex(result);
|
|
319
253
|
}
|
|
320
254
|
catch (e) {
|
|
321
255
|
span.setStatus({
|
|
322
|
-
|
|
323
|
-
|
|
256
|
+
code: SpanStatusCode.ERROR,
|
|
257
|
+
message: e.message
|
|
324
258
|
});
|
|
325
259
|
throw e;
|
|
326
260
|
}
|
|
@@ -336,13 +270,13 @@ export class SearchIndexClient {
|
|
|
336
270
|
async getSynonymMap(synonymMapName, options = {}) {
|
|
337
271
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getSynonymMaps", options);
|
|
338
272
|
try {
|
|
339
|
-
const result = await this.client.synonymMaps.get(synonymMapName, updatedOptions);
|
|
273
|
+
const result = await this.client.synonymMaps.get(synonymMapName, operationOptionsToRequestOptionsBase(updatedOptions));
|
|
340
274
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
341
275
|
}
|
|
342
276
|
catch (e) {
|
|
343
277
|
span.setStatus({
|
|
344
|
-
|
|
345
|
-
|
|
278
|
+
code: SpanStatusCode.ERROR,
|
|
279
|
+
message: e.message
|
|
346
280
|
});
|
|
347
281
|
throw e;
|
|
348
282
|
}
|
|
@@ -358,13 +292,13 @@ export class SearchIndexClient {
|
|
|
358
292
|
async createIndex(index, options = {}) {
|
|
359
293
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createIndex", options);
|
|
360
294
|
try {
|
|
361
|
-
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index), updatedOptions);
|
|
295
|
+
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index), operationOptionsToRequestOptionsBase(updatedOptions));
|
|
362
296
|
return utils.generatedIndexToPublicIndex(result);
|
|
363
297
|
}
|
|
364
298
|
catch (e) {
|
|
365
299
|
span.setStatus({
|
|
366
|
-
|
|
367
|
-
|
|
300
|
+
code: SpanStatusCode.ERROR,
|
|
301
|
+
message: e.message
|
|
368
302
|
});
|
|
369
303
|
throw e;
|
|
370
304
|
}
|
|
@@ -380,13 +314,13 @@ export class SearchIndexClient {
|
|
|
380
314
|
async createSynonymMap(synonymMap, options = {}) {
|
|
381
315
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createSynonymMaps", options);
|
|
382
316
|
try {
|
|
383
|
-
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), updatedOptions);
|
|
317
|
+
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), operationOptionsToRequestOptionsBase(updatedOptions));
|
|
384
318
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
385
319
|
}
|
|
386
320
|
catch (e) {
|
|
387
321
|
span.setStatus({
|
|
388
|
-
|
|
389
|
-
|
|
322
|
+
code: SpanStatusCode.ERROR,
|
|
323
|
+
message: e.message
|
|
390
324
|
});
|
|
391
325
|
throw e;
|
|
392
326
|
}
|
|
@@ -403,13 +337,13 @@ export class SearchIndexClient {
|
|
|
403
337
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateIndex", options);
|
|
404
338
|
try {
|
|
405
339
|
const etag = options.onlyIfUnchanged ? index.etag : undefined;
|
|
406
|
-
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
340
|
+
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { ifMatch: etag }));
|
|
407
341
|
return utils.generatedIndexToPublicIndex(result);
|
|
408
342
|
}
|
|
409
343
|
catch (e) {
|
|
410
344
|
span.setStatus({
|
|
411
|
-
|
|
412
|
-
|
|
345
|
+
code: SpanStatusCode.ERROR,
|
|
346
|
+
message: e.message
|
|
413
347
|
});
|
|
414
348
|
throw e;
|
|
415
349
|
}
|
|
@@ -426,13 +360,13 @@ export class SearchIndexClient {
|
|
|
426
360
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateSynonymMap", options);
|
|
427
361
|
try {
|
|
428
362
|
const etag = options.onlyIfUnchanged ? synonymMap.etag : undefined;
|
|
429
|
-
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
363
|
+
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { ifMatch: etag }));
|
|
430
364
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
431
365
|
}
|
|
432
366
|
catch (e) {
|
|
433
367
|
span.setStatus({
|
|
434
|
-
|
|
435
|
-
|
|
368
|
+
code: SpanStatusCode.ERROR,
|
|
369
|
+
message: e.message
|
|
436
370
|
});
|
|
437
371
|
throw e;
|
|
438
372
|
}
|
|
@@ -450,12 +384,12 @@ export class SearchIndexClient {
|
|
|
450
384
|
try {
|
|
451
385
|
const indexName = typeof index === "string" ? index : index.name;
|
|
452
386
|
const etag = typeof index === "string" ? undefined : options.onlyIfUnchanged ? index.etag : undefined;
|
|
453
|
-
await this.client.indexes.delete(indexName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
387
|
+
await this.client.indexes.delete(indexName, Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { ifMatch: etag }));
|
|
454
388
|
}
|
|
455
389
|
catch (e) {
|
|
456
390
|
span.setStatus({
|
|
457
|
-
|
|
458
|
-
|
|
391
|
+
code: SpanStatusCode.ERROR,
|
|
392
|
+
message: e.message
|
|
459
393
|
});
|
|
460
394
|
throw e;
|
|
461
395
|
}
|
|
@@ -477,103 +411,12 @@ export class SearchIndexClient {
|
|
|
477
411
|
: options.onlyIfUnchanged
|
|
478
412
|
? synonymMap.etag
|
|
479
413
|
: undefined;
|
|
480
|
-
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
414
|
+
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({}, operationOptionsToRequestOptionsBase(updatedOptions)), { ifMatch: etag }));
|
|
481
415
|
}
|
|
482
416
|
catch (e) {
|
|
483
417
|
span.setStatus({
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
});
|
|
487
|
-
throw e;
|
|
488
|
-
}
|
|
489
|
-
finally {
|
|
490
|
-
span.end();
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Creates a new search alias or updates an alias if it already exists.
|
|
495
|
-
* @param alias - The definition of the alias to create or update.
|
|
496
|
-
* @param options - The options parameters.
|
|
497
|
-
*/
|
|
498
|
-
async createOrUpdateAlias(alias, options = {}) {
|
|
499
|
-
const { span, updatedOptions } = createSpan("SearchIndexerClient-createOrUpdateAlias", options);
|
|
500
|
-
try {
|
|
501
|
-
const etag = options.onlyIfUnchanged ? alias.etag : undefined;
|
|
502
|
-
const result = await this.client.aliases.createOrUpdate(alias.name, alias, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
503
|
-
return result;
|
|
504
|
-
}
|
|
505
|
-
catch (e) {
|
|
506
|
-
span.setStatus({
|
|
507
|
-
status: "error",
|
|
508
|
-
error: e.message,
|
|
509
|
-
});
|
|
510
|
-
throw e;
|
|
511
|
-
}
|
|
512
|
-
finally {
|
|
513
|
-
span.end();
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Creates a new search alias.
|
|
518
|
-
* @param alias - The definition of the alias to create.
|
|
519
|
-
* @param options - The options parameters.
|
|
520
|
-
*/
|
|
521
|
-
async createAlias(alias, options = {}) {
|
|
522
|
-
const { span, updatedOptions } = createSpan("SearchIndexerClient-createAlias", options);
|
|
523
|
-
try {
|
|
524
|
-
const result = await this.client.aliases.create(alias, updatedOptions);
|
|
525
|
-
return result;
|
|
526
|
-
}
|
|
527
|
-
catch (e) {
|
|
528
|
-
span.setStatus({
|
|
529
|
-
status: "error",
|
|
530
|
-
error: e.message,
|
|
531
|
-
});
|
|
532
|
-
throw e;
|
|
533
|
-
}
|
|
534
|
-
finally {
|
|
535
|
-
span.end();
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Deletes a search alias and its associated mapping to an index. This operation is permanent, with no
|
|
540
|
-
* recovery option. The mapped index is untouched by this operation.
|
|
541
|
-
* @param alias - Alias/Name name of the alias to delete.
|
|
542
|
-
* @param options - The options parameters.
|
|
543
|
-
*/
|
|
544
|
-
async deleteAlias(alias, options = {}) {
|
|
545
|
-
const { span, updatedOptions } = createSpan("SearchIndexerClient-deleteAlias", options);
|
|
546
|
-
try {
|
|
547
|
-
const aliasName = typeof alias === "string" ? alias : alias.name;
|
|
548
|
-
const etag = typeof alias === "string" ? undefined : options.onlyIfUnchanged ? alias.etag : undefined;
|
|
549
|
-
await this.client.aliases.delete(aliasName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
550
|
-
}
|
|
551
|
-
catch (e) {
|
|
552
|
-
span.setStatus({
|
|
553
|
-
status: "error",
|
|
554
|
-
error: e.message,
|
|
555
|
-
});
|
|
556
|
-
throw e;
|
|
557
|
-
}
|
|
558
|
-
finally {
|
|
559
|
-
span.end();
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
/**
|
|
563
|
-
* Retrieves an alias definition.
|
|
564
|
-
* @param aliasName - The name of the alias to retrieve.
|
|
565
|
-
* @param options - The options parameters.
|
|
566
|
-
*/
|
|
567
|
-
async getAlias(aliasName, options = {}) {
|
|
568
|
-
const { span, updatedOptions } = createSpan("SearchIndexerClient-getAlias", options);
|
|
569
|
-
try {
|
|
570
|
-
const result = await this.client.aliases.get(aliasName, updatedOptions);
|
|
571
|
-
return result;
|
|
572
|
-
}
|
|
573
|
-
catch (e) {
|
|
574
|
-
span.setStatus({
|
|
575
|
-
status: "error",
|
|
576
|
-
error: e.message,
|
|
418
|
+
code: SpanStatusCode.ERROR,
|
|
419
|
+
message: e.message
|
|
577
420
|
});
|
|
578
421
|
throw e;
|
|
579
422
|
}
|
|
@@ -590,13 +433,13 @@ export class SearchIndexClient {
|
|
|
590
433
|
async getIndexStatistics(indexName, options = {}) {
|
|
591
434
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndexStatistics", options);
|
|
592
435
|
try {
|
|
593
|
-
const result = await this.client.indexes.getStatistics(indexName, updatedOptions);
|
|
436
|
+
const result = await this.client.indexes.getStatistics(indexName, operationOptionsToRequestOptionsBase(updatedOptions));
|
|
594
437
|
return result;
|
|
595
438
|
}
|
|
596
439
|
catch (e) {
|
|
597
440
|
span.setStatus({
|
|
598
|
-
|
|
599
|
-
|
|
441
|
+
code: SpanStatusCode.ERROR,
|
|
442
|
+
message: e.message
|
|
600
443
|
});
|
|
601
444
|
throw e;
|
|
602
445
|
}
|
|
@@ -611,21 +454,16 @@ export class SearchIndexClient {
|
|
|
611
454
|
* @param options - Additional arguments
|
|
612
455
|
*/
|
|
613
456
|
async analyzeText(indexName, options) {
|
|
614
|
-
const {
|
|
615
|
-
const operationOptions = {
|
|
616
|
-
abortSignal,
|
|
617
|
-
requestOptions,
|
|
618
|
-
tracingOptions,
|
|
619
|
-
};
|
|
457
|
+
const { operationOptions, restOptions } = utils.extractOperationOptions(options);
|
|
620
458
|
const { span, updatedOptions } = createSpan("SearchIndexClient-analyzeText", operationOptions);
|
|
621
459
|
try {
|
|
622
|
-
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName
|
|
460
|
+
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName }), operationOptionsToRequestOptionsBase(updatedOptions));
|
|
623
461
|
return result;
|
|
624
462
|
}
|
|
625
463
|
catch (e) {
|
|
626
464
|
span.setStatus({
|
|
627
|
-
|
|
628
|
-
|
|
465
|
+
code: SpanStatusCode.ERROR,
|
|
466
|
+
message: e.message
|
|
629
467
|
});
|
|
630
468
|
throw e;
|
|
631
469
|
}
|
|
@@ -640,13 +478,13 @@ export class SearchIndexClient {
|
|
|
640
478
|
async getServiceStatistics(options = {}) {
|
|
641
479
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getServiceStatistics", options);
|
|
642
480
|
try {
|
|
643
|
-
const result = await this.client.getServiceStatistics(updatedOptions);
|
|
481
|
+
const result = await this.client.getServiceStatistics(operationOptionsToRequestOptionsBase(updatedOptions));
|
|
644
482
|
return result;
|
|
645
483
|
}
|
|
646
484
|
catch (e) {
|
|
647
485
|
span.setStatus({
|
|
648
|
-
|
|
649
|
-
|
|
486
|
+
code: SpanStatusCode.ERROR,
|
|
487
|
+
message: e.message
|
|
650
488
|
});
|
|
651
489
|
throw e;
|
|
652
490
|
}
|