@azure/search-documents 12.0.0-beta.4 → 12.1.0-beta.1

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.
Files changed (72) hide show
  1. package/README.md +52 -32
  2. package/dist/index.js +13493 -13180
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/constants.js +2 -1
  5. package/dist-esm/src/constants.js.map +1 -1
  6. package/dist-esm/src/errorModels.js +4 -0
  7. package/dist-esm/src/errorModels.js.map +1 -0
  8. package/dist-esm/src/generated/data/models/index.js +37 -53
  9. package/dist-esm/src/generated/data/models/index.js.map +1 -1
  10. package/dist-esm/src/generated/data/models/mappers.js +398 -331
  11. package/dist-esm/src/generated/data/models/mappers.js.map +1 -1
  12. package/dist-esm/src/generated/data/models/parameters.js +195 -195
  13. package/dist-esm/src/generated/data/models/parameters.js.map +1 -1
  14. package/dist-esm/src/generated/data/operations/documents.js +41 -41
  15. package/dist-esm/src/generated/data/operations/documents.js.map +1 -1
  16. package/dist-esm/src/generated/data/operationsInterfaces/documents.js.map +1 -1
  17. package/dist-esm/src/generated/data/searchClient.js +30 -4
  18. package/dist-esm/src/generated/data/searchClient.js.map +1 -1
  19. package/dist-esm/src/generated/service/models/index.js +138 -69
  20. package/dist-esm/src/generated/service/models/index.js.map +1 -1
  21. package/dist-esm/src/generated/service/models/mappers.js +1821 -1663
  22. package/dist-esm/src/generated/service/models/mappers.js.map +1 -1
  23. package/dist-esm/src/generated/service/models/parameters.js +64 -64
  24. package/dist-esm/src/generated/service/models/parameters.js.map +1 -1
  25. package/dist-esm/src/generated/service/operations/aliases.js +22 -22
  26. package/dist-esm/src/generated/service/operations/aliases.js.map +1 -1
  27. package/dist-esm/src/generated/service/operations/dataSources.js +23 -23
  28. package/dist-esm/src/generated/service/operations/dataSources.js.map +1 -1
  29. package/dist-esm/src/generated/service/operations/indexers.js +36 -36
  30. package/dist-esm/src/generated/service/operations/indexers.js.map +1 -1
  31. package/dist-esm/src/generated/service/operations/indexes.js +30 -30
  32. package/dist-esm/src/generated/service/operations/indexes.js.map +1 -1
  33. package/dist-esm/src/generated/service/operations/skillsets.js +26 -26
  34. package/dist-esm/src/generated/service/operations/skillsets.js.map +1 -1
  35. package/dist-esm/src/generated/service/operations/synonymMaps.js +22 -22
  36. package/dist-esm/src/generated/service/operations/synonymMaps.js.map +1 -1
  37. package/dist-esm/src/generated/service/operationsInterfaces/aliases.js.map +1 -1
  38. package/dist-esm/src/generated/service/operationsInterfaces/dataSources.js.map +1 -1
  39. package/dist-esm/src/generated/service/operationsInterfaces/indexers.js.map +1 -1
  40. package/dist-esm/src/generated/service/operationsInterfaces/indexes.js.map +1 -1
  41. package/dist-esm/src/generated/service/operationsInterfaces/skillsets.js.map +1 -1
  42. package/dist-esm/src/generated/service/operationsInterfaces/synonymMaps.js.map +1 -1
  43. package/dist-esm/src/generated/service/searchServiceClient.js +35 -9
  44. package/dist-esm/src/generated/service/searchServiceClient.js.map +1 -1
  45. package/dist-esm/src/generatedStringLiteralUnions.js +4 -0
  46. package/dist-esm/src/generatedStringLiteralUnions.js.map +1 -0
  47. package/dist-esm/src/index.js +8 -9
  48. package/dist-esm/src/index.js.map +1 -1
  49. package/dist-esm/src/indexDocumentsBatch.js.map +1 -1
  50. package/dist-esm/src/indexModels.js.map +1 -1
  51. package/dist-esm/src/odata.js.map +1 -1
  52. package/dist-esm/src/odataMetadataPolicy.js.map +1 -1
  53. package/dist-esm/src/searchApiKeyCredentialPolicy.js.map +1 -1
  54. package/dist-esm/src/searchClient.js +36 -27
  55. package/dist-esm/src/searchClient.js.map +1 -1
  56. package/dist-esm/src/searchIndexClient.js +15 -29
  57. package/dist-esm/src/searchIndexClient.js.map +1 -1
  58. package/dist-esm/src/searchIndexerClient.js +9 -6
  59. package/dist-esm/src/searchIndexerClient.js.map +1 -1
  60. package/dist-esm/src/searchIndexingBufferedSender.js +3 -8
  61. package/dist-esm/src/searchIndexingBufferedSender.js.map +1 -1
  62. package/dist-esm/src/serialization.js.map +1 -1
  63. package/dist-esm/src/serviceModels.js.map +1 -1
  64. package/dist-esm/src/serviceUtils.js +44 -67
  65. package/dist-esm/src/serviceUtils.js.map +1 -1
  66. package/dist-esm/src/synonymMapHelper.browser.js.map +1 -1
  67. package/dist-esm/src/synonymMapHelper.js +1 -1
  68. package/dist-esm/src/synonymMapHelper.js.map +1 -1
  69. package/dist-esm/src/tracing.js +1 -1
  70. package/dist-esm/src/tracing.js.map +1 -1
  71. package/package.json +42 -43
  72. package/types/search-documents.d.ts +1014 -1458
package/README.md CHANGED
@@ -1,23 +1,33 @@
1
- # Azure Cognitive Search client library for JavaScript
1
+ # Azure AI Search client library for JavaScript
2
2
 
3
- [Azure Cognitive Search](https://docs.microsoft.com/azure/search/) is a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications.
3
+ [Azure AI Search](https://docs.microsoft.com/azure/search/) (formerly known as "Azure Cognitive Search") is an AI-powered information retrieval platform that helps developers build rich search experiences and generative AI apps that combine large language models with enterprise data.
4
4
 
5
- The Azure Cognitive Search service is well suited for the following application scenarios:
5
+ The Azure AI Search service is well suited for the following application scenarios:
6
6
 
7
- - Consolidate varied content types into a single searchable index. To populate an index, you can push JSON documents that contain your content, or if your data is already in Azure, create an indexer to pull in data automatically.
8
- - Attach skillsets to an indexer to create searchable content from images and large text documents. A skillset leverages AI from Cognitive Services for built-in OCR, entity recognition, key phrase extraction, language detection, text translation, and sentiment analysis. You can also add custom skills to integrate external processing of your content during data ingestion.
9
- - In a search client application, implement query logic and user experiences similar to commercial web search engines.
7
+ * Consolidate varied content types into a single searchable index.
8
+ To populate an index, you can push JSON documents that contain your content,
9
+ or if your data is already in Azure, create an indexer to pull in data
10
+ automatically.
11
+ * Attach skillsets to an indexer to create searchable content from images
12
+ and unstructured documents. A skillset leverages APIs from Azure AI Services
13
+ for built-in OCR, entity recognition, key phrase extraction, language
14
+ detection, text translation, and sentiment analysis. You can also add
15
+ custom skills to integrate external processing of your content during
16
+ data ingestion.
17
+ * In a search client application, implement query logic and user experiences
18
+ similar to commercial web search engines and chat-style apps.
10
19
 
11
20
  Use the @azure/search-documents client library to:
12
21
 
13
- - Submit queries for simple and advanced query forms that include fuzzy search, wildcard search, regular expressions.
14
- - Implement filtered queries for faceted navigation, geospatial search, or to narrow results based on filter criteria.
15
- - Create and manage search indexes.
16
- - Upload and update documents in the search index.
17
- - Create and manage indexers that pull data from Azure into an index.
18
- - Create and manage skillsets that add AI enrichment to data ingestion.
19
- - Create and manage analyzers for advanced text analysis or multi-lingual content.
20
- - Optimize results through scoring profiles to factor in business logic or freshness.
22
+ * Submit queries using vector, keyword, and hybrid query forms.
23
+ * Implement filtered queries for metadata, geospatial search, faceted navigation,
24
+ or to narrow results based on filter criteria.
25
+ * Create and manage search indexes.
26
+ * Upload and update documents in the search index.
27
+ * Create and manage indexers that pull data from Azure into an index.
28
+ * Create and manage skillsets that add AI enrichment to data ingestion.
29
+ * Create and manage analyzers for advanced text analysis or multi-lingual content.
30
+ * Optimize results through semantic ranking and scoring profiles to factor in business logic or freshness.
21
31
 
22
32
  Key links:
23
33
 
@@ -39,7 +49,7 @@ npm install @azure/search-documents
39
49
  ### Currently supported environments
40
50
 
41
51
  - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
42
- - Latest versions of Safari, Chrome, Edge, and Firefox.
52
+ - Latest versions of Safari, Chrome, Microsoft Edge, and Firefox.
43
53
 
44
54
  See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
45
55
 
@@ -58,16 +68,20 @@ See [choosing a pricing tier](https://docs.microsoft.com/azure/search/search-sku
58
68
 
59
69
  ### Authenticate the client
60
70
 
61
- All requests to a search service need an API key that was generated specifically for your service. [The API key is the sole mechanism for authenticating access to your search service endpoint.](https://docs.microsoft.com/azure/search/search-security-api-keys)
71
+ To interact with the search service, you'll need to create an instance of the appropriate client class: `SearchClient` for searching indexed documents, `SearchIndexClient` for managing indexes, or `SearchIndexerClient` for crawling data sources and loading search documents into an index. To instantiate a client object, you'll need an **endpoint** and **Azure roles** or an **API key**. You can refer to the documentation for more information on [supported authenticating approaches](https://learn.microsoft.com/azure/search/search-security-overview#authentication) with the search service.
62
72
 
63
- You can obtain your api-key from the [Azure portal](https://portal.azure.com/) or via the Azure CLI:
73
+ #### Get an API Key
64
74
 
65
- ```PowerShell
75
+ An API key can be an easier approach to start with because it doesn't require pre-existing role assignments.
76
+
77
+ You can get the **endpoint** and an **API key** from the search service in the [Azure portal](https://portal.azure.com/). Please refer the [documentation](https://docs.microsoft.com/azure/search/search-security-api-keys) for instructions on how to get an API key.
78
+
79
+ Alternatively, you can use the following [Azure CLI](https://learn.microsoft.com/cli/azure/) command to retrieve the API key from the search service:
80
+
81
+ ```Powershell
66
82
  az search admin-key show --resource-group <your-resource-group-name> --service-name <your-resource-name>
67
83
  ```
68
84
 
69
- Alternatively, you can get the endpoint and Admin Key from the resource information in the [Azure Portal][azure_portal].
70
-
71
85
  There are two types of keys used to access your search service: **admin** _(read-write)_ and **query** _(read-only)_ keys. Restricting access and operations in client apps is essential to safeguarding the search assets on your service. Always use a query key rather than an admin key for any query originating from a client app.
72
86
 
73
87
  _Note: The example Azure CLI snippet above retrieves an admin key so it's easier to get started exploring APIs, but it should be managed carefully._
@@ -134,17 +148,24 @@ const indexerClient = new SearchIndexerClient("<endpoint>", new AzureKeyCredenti
134
148
 
135
149
  ## Key concepts
136
150
 
137
- An Azure Cognitive Search service contains one or more indexes that provide persistent storage of searchable data in the form of JSON documents. _(If you're brand new to search, you can make a very rough analogy between indexes and database tables.)_ The @azure/search-documents client library
151
+ An Azure AI Search service contains one or more indexes that provide persistent storage of searchable data in the form of JSON documents. _(If you're brand new to search, you can make a very rough analogy between indexes and database tables.)_ The @azure/search-documents client library
138
152
  exposes operations on these resources through three main client types.
139
153
 
140
154
  - `SearchClient` helps with:
141
- - [Searching](https://docs.microsoft.com/azure/search/search-lucene-query-architecture) your indexed documents using [rich queries](https://docs.microsoft.com/azure/search/search-query-overview) and [powerful data shaping](https://docs.microsoft.com/azure/search/search-filters)
155
+ - [Searching](https://docs.microsoft.com/azure/search/search-lucene-query-architecture)
156
+ your indexed documents using [vector queries](https://learn.microsoft.com/azure/search/vector-search-how-to-query),
157
+ [keyword queries](https://learn.microsoft.com/azure/search/search-query-create)
158
+ and [hybrid queries](https://learn.microsoft.com/azure/search/hybrid-search-how-to-query)
159
+ - [Vector query filters](https://learn.microsoft.com/azure/search/vector-search-filters) and [Text query filters](https://learn.microsoft.com/azure/search/search-filters)
160
+ - [Semantic ranking](https://learn.microsoft.com/azure/search/semantic-how-to-query-request) and [scoring profiles](https://learn.microsoft.com/azure/search/index-add-scoring-profiles) for boosting relevance
142
161
  - [Autocompleting](https://docs.microsoft.com/rest/api/searchservice/autocomplete) partially typed search terms based on documents in the index
143
162
  - [Suggesting](https://docs.microsoft.com/rest/api/searchservice/suggestions) the most likely matching text in documents as a user types
144
163
  - [Adding, Updating or Deleting Documents](https://docs.microsoft.com/rest/api/searchservice/addupdate-or-delete-documents) documents from an index
164
+
145
165
  - `SearchIndexClient` allows you to:
146
166
  - [Create, delete, update, or configure a search index](https://docs.microsoft.com/rest/api/searchservice/index-operations)
147
167
  - [Declare custom synonym maps to expand or rewrite queries](https://docs.microsoft.com/rest/api/searchservice/synonym-map-operations)
168
+
148
169
  - `SearchIndexerClient` allows you to:
149
170
  - [Start indexers to automatically crawl data sources](https://docs.microsoft.com/rest/api/searchservice/indexer-operations)
150
171
  - [Define AI powered Skillsets to transform and enrich your data](https://docs.microsoft.com/rest/api/searchservice/skillset-operations)
@@ -328,14 +349,14 @@ interface Hotel {
328
349
  hotelId?: string;
329
350
  hotelName?: string | null;
330
351
  description?: string | null;
331
- descriptionVector?: Array<number> | null;
352
+ descriptionVector?: Array<number>;
332
353
  parkingIncluded?: boolean | null;
333
354
  lastRenovationDate?: Date | null;
334
355
  rating?: number | null;
335
356
  rooms?: Array<{
336
357
  beds?: number | null;
337
358
  description?: string | null;
338
- } | null>;
359
+ }>;
339
360
  }
340
361
 
341
362
  const client = new SearchClient<Hotel>(
@@ -354,7 +375,7 @@ async function main() {
354
375
  // These are other ways to declare the correct type for `select`.
355
376
  const select = ["hotelId", "hotelName", "rooms/beds"] as const;
356
377
  // This declaration lets you opt out of narrowing the TypeScript type of your documents,
357
- // though the Cognitive Search service will still only return these fields.
378
+ // though the AI Search service will still only return these fields.
358
379
  const selectWide: SelectFields<Hotel>[] = ["hotelId", "hotelName", "rooms/beds"];
359
380
  // This is an invalid declaration. Passing this to `select` will result in a compiler error
360
381
  // unless you opt out of including the model in the client constructor.
@@ -385,7 +406,7 @@ async function main() {
385
406
  const searchResults = await client.search("WiFi", {
386
407
  filter: odata`Rooms/any(room: room/BaseRate lt ${baseRateMax}) and Rating ge ${ratingMin}`,
387
408
  orderBy: ["Rating desc"],
388
- select: ["hotelId", "hotelName", "rating"],
409
+ select: ["hotelId", "hotelName", "Rating"],
389
410
  });
390
411
  for await (const result of searchResults.results) {
391
412
  // Each result will have "HotelId", "HotelName", and "Rating"
@@ -399,7 +420,7 @@ main();
399
420
 
400
421
  #### Querying with vectors
401
422
 
402
- Text embeddings can be queried using the `vector` search parameter.
423
+ Text embeddings can be queried using the `vector` search parameter. See [Query vectors](https://learn.microsoft.com/azure/search/vector-search-how-to-query) and [Filter vector queries](https://learn.microsoft.com/azure/search/vector-search-filters) for more information.
403
424
 
404
425
  ```js
405
426
  const { SearchClient, AzureKeyCredential, odata } = require("@azure/search-documents");
@@ -462,7 +483,7 @@ When retrieving results, a `facets` property will be available that will indicat
462
483
 
463
484
  ### Logging
464
485
 
465
- Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
486
+ Enabling logging can help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
466
487
 
467
488
  ```javascript
468
489
  import { setLogLevel } from "@azure/logger";
@@ -475,8 +496,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur
475
496
  ## Next steps
476
497
 
477
498
  - [Go further with search-documents and our samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/search/search-documents/samples)
478
- - [Watch a demo or deep dive video](https://azure.microsoft.com/resources/videos/index/?services=search)
479
- - [Read more about the Azure Cognitive Search service](https://docs.microsoft.com/azure/search/search-what-is-azure-search)
499
+ - [Read more about the Azure AI Search service](https://docs.microsoft.com/azure/search/search-what-is-azure-search)
480
500
 
481
501
  ## Contributing
482
502
 
@@ -484,11 +504,11 @@ If you'd like to contribute to this library, please read the [contributing guide
484
504
 
485
505
  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].
486
506
 
487
- This project has adopted the [Microsoft Open Source Code of Conduct][coc].For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
507
+ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
488
508
 
489
509
  ## Related projects
490
510
 
491
- - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
511
+ - [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
492
512
 
493
513
  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fsearch%2Fsearch%2FREADME.png)
494
514