@azure/search-documents 11.3.0 → 12.0.0-alpha.20230306.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -41
- package/dist/index.js +3897 -1007
- 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 +202 -1
- package/dist-esm/src/generated/data/models/index.js.map +1 -1
- package/dist-esm/src/generated/data/models/mappers.js +138 -1
- package/dist-esm/src/generated/data/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/data/models/parameters.js +72 -22
- package/dist-esm/src/generated/data/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/data/operations/documents.js +32 -76
- package/dist-esm/src/generated/data/operations/documents.js.map +1 -1
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js +9 -0
- package/dist-esm/src/generated/data/operationsInterfaces/documents.js.map +1 -0
- package/dist-esm/src/generated/data/operationsInterfaces/index.js +9 -0
- package/dist-esm/src/generated/data/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/generated/data/searchClient.js +33 -5
- package/dist-esm/src/generated/data/searchClient.js.map +1 -1
- package/dist-esm/src/generated/data/searchClientContext.js +13 -11
- 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 +1284 -1
- package/dist-esm/src/generated/service/models/index.js.map +1 -1
- package/dist-esm/src/generated/service/models/mappers.js +750 -25
- package/dist-esm/src/generated/service/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/service/models/parameters.js +51 -10
- package/dist-esm/src/generated/service/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/service/operations/aliases.js +160 -0
- package/dist-esm/src/generated/service/operations/aliases.js.map +1 -0
- package/dist-esm/src/generated/service/operations/dataSources.js +16 -39
- package/dist-esm/src/generated/service/operations/dataSources.js.map +1 -1
- package/dist-esm/src/generated/service/operations/index.js +1 -0
- package/dist-esm/src/generated/service/operations/index.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexers.js +47 -57
- package/dist-esm/src/generated/service/operations/indexers.js.map +1 -1
- package/dist-esm/src/generated/service/operations/indexes.js +16 -55
- package/dist-esm/src/generated/service/operations/indexes.js.map +1 -1
- package/dist-esm/src/generated/service/operations/skillsets.js +42 -39
- package/dist-esm/src/generated/service/operations/skillsets.js.map +1 -1
- package/dist-esm/src/generated/service/operations/synonymMaps.js +12 -38
- package/dist-esm/src/generated/service/operations/synonymMaps.js.map +1 -1
- package/dist-esm/src/generated/service/operationsInterfaces/aliases.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/aliases.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/index.js +14 -0
- package/dist-esm/src/generated/service/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexers.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/indexes.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js.map +1 -0
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js +9 -0
- package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js.map +1 -0
- package/dist-esm/src/generated/service/searchServiceClient.js +38 -16
- package/dist-esm/src/generated/service/searchServiceClient.js.map +1 -1
- package/dist-esm/src/generated/service/searchServiceClientContext.js +13 -11
- 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 +4 -2
- 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 +0 -1
- package/dist-esm/src/indexModels.js.map +1 -1
- package/dist-esm/src/odataMetadataPolicy.js +7 -15
- package/dist-esm/src/odataMetadataPolicy.js.map +1 -1
- package/dist-esm/src/searchApiKeyCredentialPolicy.js +8 -21
- package/dist-esm/src/searchApiKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/src/searchAudience.js.map +1 -1
- package/dist-esm/src/searchClient.js +200 -70
- package/dist-esm/src/searchClient.js.map +1 -1
- package/dist-esm/src/searchIndexClient.js +240 -74
- package/dist-esm/src/searchIndexClient.js.map +1 -1
- package/dist-esm/src/searchIndexerClient.js +143 -86
- package/dist-esm/src/searchIndexerClient.js.map +1 -1
- package/dist-esm/src/searchIndexingBufferedSender.js +16 -17
- 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 +68 -31
- package/dist-esm/src/serviceUtils.js.map +1 -1
- package/dist-esm/src/synonymMapHelper.js +6 -2
- package/dist-esm/src/synonymMapHelper.js.map +1 -1
- package/dist-esm/src/tracing.js +6 -5
- package/dist-esm/src/tracing.js.map +1 -1
- package/package.json +48 -49
- package/types/search-documents.d.ts +1935 -235
- package/CHANGELOG.md +0 -227
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
3
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __rest } from "tslib";
|
|
4
4
|
/// <reference lib="esnext.asynciterable" />
|
|
5
5
|
import { isTokenCredential } from "@azure/core-auth";
|
|
6
|
-
import {
|
|
7
|
-
import { SpanStatusCode } from "@azure/core-tracing";
|
|
6
|
+
import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
|
|
8
7
|
import { SDK_VERSION } from "./constants";
|
|
9
8
|
import { SearchServiceClient as GeneratedClient } from "./generated/service/searchServiceClient";
|
|
10
9
|
import { logger } from "./logger";
|
|
11
10
|
import { createSearchApiKeyCredentialPolicy } from "./searchApiKeyCredentialPolicy";
|
|
12
11
|
import * as utils from "./serviceUtils";
|
|
13
12
|
import { createSpan } from "./tracing";
|
|
14
|
-
import {
|
|
13
|
+
import { createOdataMetadataPolicy } from "./odataMetadataPolicy";
|
|
15
14
|
import { SearchClient } from "./searchClient";
|
|
16
15
|
import { KnownSearchAudience } from "./searchAudience";
|
|
17
16
|
/**
|
|
@@ -40,7 +39,12 @@ export class SearchIndexClient {
|
|
|
40
39
|
/**
|
|
41
40
|
* The API version to use when communicating with the service.
|
|
42
41
|
*/
|
|
43
|
-
this.
|
|
42
|
+
this.serviceVersion = utils.defaultServiceVersion;
|
|
43
|
+
/**
|
|
44
|
+
* The API version to use when communicating with the service.
|
|
45
|
+
* @deprecated use {@Link serviceVersion} instead
|
|
46
|
+
*/
|
|
47
|
+
this.apiVersion = utils.defaultServiceVersion;
|
|
44
48
|
this.endpoint = endpoint;
|
|
45
49
|
this.credential = credential;
|
|
46
50
|
this.options = options;
|
|
@@ -54,50 +58,57 @@ export class SearchIndexClient {
|
|
|
54
58
|
else {
|
|
55
59
|
options.userAgentOptions.userAgentPrefix = libInfo;
|
|
56
60
|
}
|
|
57
|
-
const
|
|
61
|
+
const internalClientPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
58
62
|
loggingOptions: {
|
|
59
63
|
logger: logger.info,
|
|
60
|
-
|
|
64
|
+
additionalAllowedHeaderNames: [
|
|
61
65
|
"elapsed-time",
|
|
62
66
|
"Location",
|
|
63
67
|
"OData-MaxVersion",
|
|
64
68
|
"OData-Version",
|
|
65
69
|
"Prefer",
|
|
66
|
-
"throttle-reason"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
70
|
+
"throttle-reason",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
69
73
|
});
|
|
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;
|
|
81
74
|
if (options.apiVersion) {
|
|
82
|
-
if (!
|
|
75
|
+
if (!utils.serviceVersions.includes(options.apiVersion)) {
|
|
83
76
|
throw new Error(`Invalid Api Version: ${options.apiVersion}`);
|
|
84
77
|
}
|
|
85
|
-
|
|
78
|
+
this.serviceVersion = options.apiVersion;
|
|
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;
|
|
86
87
|
}
|
|
87
|
-
this.client = new GeneratedClient(this.endpoint,
|
|
88
|
+
this.client = new GeneratedClient(this.endpoint, this.serviceVersion, internalClientPipelineOptions);
|
|
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"));
|
|
88
99
|
}
|
|
89
100
|
listIndexesPage(options = {}) {
|
|
90
101
|
return __asyncGenerator(this, arguments, function* listIndexesPage_1() {
|
|
91
102
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesPage", options);
|
|
92
103
|
try {
|
|
93
|
-
const result = yield __await(this.client.indexes.list(
|
|
104
|
+
const result = yield __await(this.client.indexes.list(updatedOptions));
|
|
94
105
|
const mapped = result.indexes.map(utils.generatedIndexToPublicIndex);
|
|
95
106
|
yield yield __await(mapped);
|
|
96
107
|
}
|
|
97
108
|
catch (e) {
|
|
98
109
|
span.setStatus({
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
status: "error",
|
|
111
|
+
error: e.message,
|
|
101
112
|
});
|
|
102
113
|
throw e;
|
|
103
114
|
}
|
|
@@ -139,21 +150,76 @@ export class SearchIndexClient {
|
|
|
139
150
|
},
|
|
140
151
|
byPage: () => {
|
|
141
152
|
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; }
|
|
142
190
|
}
|
|
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
|
+
},
|
|
143
209
|
};
|
|
144
210
|
}
|
|
145
211
|
listIndexesNamesPage(options = {}) {
|
|
146
212
|
return __asyncGenerator(this, arguments, function* listIndexesNamesPage_1() {
|
|
147
213
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listIndexesNamesPage", options);
|
|
148
214
|
try {
|
|
149
|
-
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({},
|
|
215
|
+
const result = yield __await(this.client.indexes.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" })));
|
|
150
216
|
const mapped = result.indexes.map((idx) => idx.name);
|
|
151
217
|
yield yield __await(mapped);
|
|
152
218
|
}
|
|
153
219
|
catch (e) {
|
|
154
220
|
span.setStatus({
|
|
155
|
-
|
|
156
|
-
|
|
221
|
+
status: "error",
|
|
222
|
+
error: e.message,
|
|
157
223
|
});
|
|
158
224
|
throw e;
|
|
159
225
|
}
|
|
@@ -164,19 +230,19 @@ export class SearchIndexClient {
|
|
|
164
230
|
}
|
|
165
231
|
listIndexesNamesAll(options = {}) {
|
|
166
232
|
return __asyncGenerator(this, arguments, function* listIndexesNamesAll_1() {
|
|
167
|
-
var
|
|
233
|
+
var e_3, _a;
|
|
168
234
|
try {
|
|
169
235
|
for (var _b = __asyncValues(this.listIndexesNamesPage(options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
170
236
|
const page = _c.value;
|
|
171
237
|
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
172
238
|
}
|
|
173
239
|
}
|
|
174
|
-
catch (
|
|
240
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
175
241
|
finally {
|
|
176
242
|
try {
|
|
177
243
|
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
178
244
|
}
|
|
179
|
-
finally { if (
|
|
245
|
+
finally { if (e_3) throw e_3.error; }
|
|
180
246
|
}
|
|
181
247
|
});
|
|
182
248
|
}
|
|
@@ -195,7 +261,7 @@ export class SearchIndexClient {
|
|
|
195
261
|
},
|
|
196
262
|
byPage: () => {
|
|
197
263
|
return this.listIndexesNamesPage(options);
|
|
198
|
-
}
|
|
264
|
+
},
|
|
199
265
|
};
|
|
200
266
|
}
|
|
201
267
|
/**
|
|
@@ -205,13 +271,13 @@ export class SearchIndexClient {
|
|
|
205
271
|
async listSynonymMaps(options = {}) {
|
|
206
272
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMaps", options);
|
|
207
273
|
try {
|
|
208
|
-
const result = await this.client.synonymMaps.list(
|
|
274
|
+
const result = await this.client.synonymMaps.list(updatedOptions);
|
|
209
275
|
return result.synonymMaps.map(utils.generatedSynonymMapToPublicSynonymMap);
|
|
210
276
|
}
|
|
211
277
|
catch (e) {
|
|
212
278
|
span.setStatus({
|
|
213
|
-
|
|
214
|
-
|
|
279
|
+
status: "error",
|
|
280
|
+
error: e.message,
|
|
215
281
|
});
|
|
216
282
|
throw e;
|
|
217
283
|
}
|
|
@@ -226,13 +292,13 @@ export class SearchIndexClient {
|
|
|
226
292
|
async listSynonymMapsNames(options = {}) {
|
|
227
293
|
const { span, updatedOptions } = createSpan("SearchIndexClient-listSynonymMapsNames", options);
|
|
228
294
|
try {
|
|
229
|
-
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({},
|
|
295
|
+
const result = await this.client.synonymMaps.list(Object.assign(Object.assign({}, updatedOptions), { select: "name" }));
|
|
230
296
|
return result.synonymMaps.map((sm) => sm.name);
|
|
231
297
|
}
|
|
232
298
|
catch (e) {
|
|
233
299
|
span.setStatus({
|
|
234
|
-
|
|
235
|
-
|
|
300
|
+
status: "error",
|
|
301
|
+
error: e.message,
|
|
236
302
|
});
|
|
237
303
|
throw e;
|
|
238
304
|
}
|
|
@@ -248,13 +314,13 @@ export class SearchIndexClient {
|
|
|
248
314
|
async getIndex(indexName, options = {}) {
|
|
249
315
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndex", options);
|
|
250
316
|
try {
|
|
251
|
-
const result = await this.client.indexes.get(indexName,
|
|
317
|
+
const result = await this.client.indexes.get(indexName, updatedOptions);
|
|
252
318
|
return utils.generatedIndexToPublicIndex(result);
|
|
253
319
|
}
|
|
254
320
|
catch (e) {
|
|
255
321
|
span.setStatus({
|
|
256
|
-
|
|
257
|
-
|
|
322
|
+
status: "error",
|
|
323
|
+
error: e.message,
|
|
258
324
|
});
|
|
259
325
|
throw e;
|
|
260
326
|
}
|
|
@@ -270,13 +336,13 @@ export class SearchIndexClient {
|
|
|
270
336
|
async getSynonymMap(synonymMapName, options = {}) {
|
|
271
337
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getSynonymMaps", options);
|
|
272
338
|
try {
|
|
273
|
-
const result = await this.client.synonymMaps.get(synonymMapName,
|
|
339
|
+
const result = await this.client.synonymMaps.get(synonymMapName, updatedOptions);
|
|
274
340
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
275
341
|
}
|
|
276
342
|
catch (e) {
|
|
277
343
|
span.setStatus({
|
|
278
|
-
|
|
279
|
-
|
|
344
|
+
status: "error",
|
|
345
|
+
error: e.message,
|
|
280
346
|
});
|
|
281
347
|
throw e;
|
|
282
348
|
}
|
|
@@ -292,13 +358,13 @@ export class SearchIndexClient {
|
|
|
292
358
|
async createIndex(index, options = {}) {
|
|
293
359
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createIndex", options);
|
|
294
360
|
try {
|
|
295
|
-
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index),
|
|
361
|
+
const result = await this.client.indexes.create(utils.publicIndexToGeneratedIndex(index), updatedOptions);
|
|
296
362
|
return utils.generatedIndexToPublicIndex(result);
|
|
297
363
|
}
|
|
298
364
|
catch (e) {
|
|
299
365
|
span.setStatus({
|
|
300
|
-
|
|
301
|
-
|
|
366
|
+
status: "error",
|
|
367
|
+
error: e.message,
|
|
302
368
|
});
|
|
303
369
|
throw e;
|
|
304
370
|
}
|
|
@@ -314,13 +380,13 @@ export class SearchIndexClient {
|
|
|
314
380
|
async createSynonymMap(synonymMap, options = {}) {
|
|
315
381
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createSynonymMaps", options);
|
|
316
382
|
try {
|
|
317
|
-
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap),
|
|
383
|
+
const result = await this.client.synonymMaps.create(utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), updatedOptions);
|
|
318
384
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
319
385
|
}
|
|
320
386
|
catch (e) {
|
|
321
387
|
span.setStatus({
|
|
322
|
-
|
|
323
|
-
|
|
388
|
+
status: "error",
|
|
389
|
+
error: e.message,
|
|
324
390
|
});
|
|
325
391
|
throw e;
|
|
326
392
|
}
|
|
@@ -337,13 +403,13 @@ export class SearchIndexClient {
|
|
|
337
403
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateIndex", options);
|
|
338
404
|
try {
|
|
339
405
|
const etag = options.onlyIfUnchanged ? index.etag : undefined;
|
|
340
|
-
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({},
|
|
406
|
+
const result = await this.client.indexes.createOrUpdate(index.name, utils.publicIndexToGeneratedIndex(index), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
341
407
|
return utils.generatedIndexToPublicIndex(result);
|
|
342
408
|
}
|
|
343
409
|
catch (e) {
|
|
344
410
|
span.setStatus({
|
|
345
|
-
|
|
346
|
-
|
|
411
|
+
status: "error",
|
|
412
|
+
error: e.message,
|
|
347
413
|
});
|
|
348
414
|
throw e;
|
|
349
415
|
}
|
|
@@ -360,13 +426,13 @@ export class SearchIndexClient {
|
|
|
360
426
|
const { span, updatedOptions } = createSpan("SearchIndexClient-createOrUpdateSynonymMap", options);
|
|
361
427
|
try {
|
|
362
428
|
const etag = options.onlyIfUnchanged ? synonymMap.etag : undefined;
|
|
363
|
-
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({},
|
|
429
|
+
const result = await this.client.synonymMaps.createOrUpdate(synonymMap.name, utils.publicSynonymMapToGeneratedSynonymMap(synonymMap), Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
364
430
|
return utils.generatedSynonymMapToPublicSynonymMap(result);
|
|
365
431
|
}
|
|
366
432
|
catch (e) {
|
|
367
433
|
span.setStatus({
|
|
368
|
-
|
|
369
|
-
|
|
434
|
+
status: "error",
|
|
435
|
+
error: e.message,
|
|
370
436
|
});
|
|
371
437
|
throw e;
|
|
372
438
|
}
|
|
@@ -384,12 +450,12 @@ export class SearchIndexClient {
|
|
|
384
450
|
try {
|
|
385
451
|
const indexName = typeof index === "string" ? index : index.name;
|
|
386
452
|
const etag = typeof index === "string" ? undefined : options.onlyIfUnchanged ? index.etag : undefined;
|
|
387
|
-
await this.client.indexes.delete(indexName, Object.assign(Object.assign({},
|
|
453
|
+
await this.client.indexes.delete(indexName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
388
454
|
}
|
|
389
455
|
catch (e) {
|
|
390
456
|
span.setStatus({
|
|
391
|
-
|
|
392
|
-
|
|
457
|
+
status: "error",
|
|
458
|
+
error: e.message,
|
|
393
459
|
});
|
|
394
460
|
throw e;
|
|
395
461
|
}
|
|
@@ -411,12 +477,103 @@ export class SearchIndexClient {
|
|
|
411
477
|
: options.onlyIfUnchanged
|
|
412
478
|
? synonymMap.etag
|
|
413
479
|
: undefined;
|
|
414
|
-
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({},
|
|
480
|
+
await this.client.synonymMaps.delete(synonymMapName, Object.assign(Object.assign({}, updatedOptions), { ifMatch: etag }));
|
|
415
481
|
}
|
|
416
482
|
catch (e) {
|
|
417
483
|
span.setStatus({
|
|
418
|
-
|
|
419
|
-
|
|
484
|
+
status: "error",
|
|
485
|
+
error: e.message,
|
|
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,
|
|
420
577
|
});
|
|
421
578
|
throw e;
|
|
422
579
|
}
|
|
@@ -433,13 +590,13 @@ export class SearchIndexClient {
|
|
|
433
590
|
async getIndexStatistics(indexName, options = {}) {
|
|
434
591
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getIndexStatistics", options);
|
|
435
592
|
try {
|
|
436
|
-
const result = await this.client.indexes.getStatistics(indexName,
|
|
593
|
+
const result = await this.client.indexes.getStatistics(indexName, updatedOptions);
|
|
437
594
|
return result;
|
|
438
595
|
}
|
|
439
596
|
catch (e) {
|
|
440
597
|
span.setStatus({
|
|
441
|
-
|
|
442
|
-
|
|
598
|
+
status: "error",
|
|
599
|
+
error: e.message,
|
|
443
600
|
});
|
|
444
601
|
throw e;
|
|
445
602
|
}
|
|
@@ -454,16 +611,21 @@ export class SearchIndexClient {
|
|
|
454
611
|
* @param options - Additional arguments
|
|
455
612
|
*/
|
|
456
613
|
async analyzeText(indexName, options) {
|
|
457
|
-
const {
|
|
614
|
+
const { abortSignal, requestOptions, tracingOptions } = options, restOptions = __rest(options, ["abortSignal", "requestOptions", "tracingOptions"]);
|
|
615
|
+
const operationOptions = {
|
|
616
|
+
abortSignal,
|
|
617
|
+
requestOptions,
|
|
618
|
+
tracingOptions,
|
|
619
|
+
};
|
|
458
620
|
const { span, updatedOptions } = createSpan("SearchIndexClient-analyzeText", operationOptions);
|
|
459
621
|
try {
|
|
460
|
-
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName }),
|
|
622
|
+
const result = await this.client.indexes.analyze(indexName, Object.assign(Object.assign({}, restOptions), { analyzer: restOptions.analyzerName, tokenizer: restOptions.tokenizerName, normalizer: restOptions.normalizerName }), updatedOptions);
|
|
461
623
|
return result;
|
|
462
624
|
}
|
|
463
625
|
catch (e) {
|
|
464
626
|
span.setStatus({
|
|
465
|
-
|
|
466
|
-
|
|
627
|
+
status: "error",
|
|
628
|
+
error: e.message,
|
|
467
629
|
});
|
|
468
630
|
throw e;
|
|
469
631
|
}
|
|
@@ -478,13 +640,13 @@ export class SearchIndexClient {
|
|
|
478
640
|
async getServiceStatistics(options = {}) {
|
|
479
641
|
const { span, updatedOptions } = createSpan("SearchIndexClient-getServiceStatistics", options);
|
|
480
642
|
try {
|
|
481
|
-
const result = await this.client.getServiceStatistics(
|
|
643
|
+
const result = await this.client.getServiceStatistics(updatedOptions);
|
|
482
644
|
return result;
|
|
483
645
|
}
|
|
484
646
|
catch (e) {
|
|
485
647
|
span.setStatus({
|
|
486
|
-
|
|
487
|
-
|
|
648
|
+
status: "error",
|
|
649
|
+
error: e.message,
|
|
488
650
|
});
|
|
489
651
|
throw e;
|
|
490
652
|
}
|
|
@@ -496,6 +658,10 @@ export class SearchIndexClient {
|
|
|
496
658
|
* Retrieves the SearchClient corresponding to this SearchIndexClient
|
|
497
659
|
* @param indexName - Name of the index
|
|
498
660
|
* @param options - SearchClient Options
|
|
661
|
+
* @typeParam Model - An optional type that represents the documents stored in
|
|
662
|
+
* the search index. For the best typing experience, all non-key fields should
|
|
663
|
+
* be marked optional and nullable, and the key property should have the
|
|
664
|
+
* non-nullable type `string`.
|
|
499
665
|
*/
|
|
500
666
|
getSearchClient(indexName, options) {
|
|
501
667
|
return new SearchClient(this.endpoint, indexName, this.credential, options || this.options);
|