You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/search/search-documents/README.md
+55-35Lines changed: 55 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,33 @@
1
-
# Azure Cognitive Search client library for JavaScript
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.
4
-
5
-
The Azure Cognitive Search service is well suited for the following application scenarios:
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.
10
-
11
-
Use the @azure/search-documents client library to:
12
-
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.
1
+
# Azure AI Search client library for JavaScript
2
+
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
+
5
+
The Azure AI Search service is well suited for the following application scenarios:
6
+
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.
19
+
20
+
Use the Azure.Search.Documents client library to:
21
+
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.
-[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.
72
+
73
+
#### Get an API Key
62
74
63
-
You can obtain your api-key from the [Azure portal](https://portal.azure.com/) or via the Azure CLI:
75
+
An API key can be an easier approach to start with because it doesn't require pre-existing role assignments.
64
76
65
-
```PowerShell
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)
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)
@@ -354,7 +375,7 @@ async function main() {
354
375
// These are other ways to declare the correct type for `select`.
// 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.
@@ -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.
@@ -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,20 +496,19 @@ 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
483
503
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
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 [[email protected]][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 [[email protected]][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)
0 commit comments