Skip to content

Commit f8a8fee

Browse files
authored
Add Troubleshooting Guide to azure-search-documents (Azure#28102)
Add Troubleshooting Guide to azure-search-documents
1 parent d484f6a commit f8a8fee

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

sdk/search/azure-search-documents/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ searchAsyncClient.search("luxury")
422422

423423
## Troubleshooting
424424

425+
See our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/search/azure-search-documents/TROUBLESHOOTING.md)
426+
for details on how to diagnose various failure scenarios.
427+
425428
### General
426429

427430
When you interact with Azure Cognitive Search using this Java client library, errors returned by the service correspond
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Troubleshooting Azure Cognitive Search SDK Issues
2+
3+
The `azure-search-documents` package provides APIs for operations on the
4+
[Azure Cognitive Search](https://docs.microsoft.com/azure/search/search-what-is-azure-search) cloud service.
5+
6+
## Table of Contents
7+
8+
* [Identifying and Troubleshooting Issues by Response Code](#troubleshooting-issues-by-response-code)
9+
* [HTTP 207 Errors](#207-multi-status)
10+
* [HTTP 404 Errors](#404-not-found)
11+
* [HTTP 429 Errors](#429-too-many-requests)
12+
* [Unexpected search query results](#unexpected-search-query-results)
13+
14+
## Troubleshooting Issues By Response Code
15+
16+
See [this page](https://docs.microsoft.com/rest/api/searchservice/http-status-codes) for the common response status
17+
codes sent by the Azure Cognitive Search service.
18+
19+
### 207 Multi-Status
20+
21+
This response status indicates a partial success for an indexing operation. Some documents were successfully processed,
22+
but at least one failed. Details of the failed documents are present in the individual `IndexingResult` objects within
23+
the `IndexDocumentsResult`. If you want the [`indexDocumentsWithResponse`](https://docs.microsoft.com/java/api/com.azure.search.documents.searchclient.indexdocumentswithresponse?view=azure-java-stable)
24+
method call to throw an exception on any failure, set [`IndexDocumentsOptions.throwOnAnyError`](https://docs.microsoft.com/java/api/com.azure.search.documents.models.indexdocumentsoptions.setthrowonanyerror?view=azure-java-stable#com-azure-search-documents-models-indexdocumentsoptions-setthrowonanyerror(boolean))
25+
to `true`. Each failure is then recorded in a separate `IndexingResult` and a single `IndexBatchException` is thrown by
26+
the method.
27+
28+
### 403 Forbidden
29+
30+
Returned when you pass an invalid api-key. Search service uses two types of keys to control access: admin (read-write)
31+
and query (read-only). The **admin key** grants full rights to all operations, including the ability to manage the service,
32+
create and delete indexes, indexers, and data sources. The **query key** grants read-only access to indexes and documents.
33+
Ensure that the key used for an API call provides sufficient privileges for the operation. See [here](https://docs.microsoft.com/azure/search/search-security-api-keys)
34+
for details about managing API keys.
35+
36+
If you are using the `azure-identity` package to authenticate requests to Azure Cognitive Search, please see our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md).
37+
38+
### 404 Not Found
39+
40+
Returned when a resource does not exist on the server. If you are managing or querying an index, check the syntax and
41+
verify the index name is specified correctly.
42+
43+
### 429 too many requests
44+
45+
If this error occurs while you are trying to create an index, it means you already have the maximum number of indexes
46+
allowed for your pricing tier. A count of the indexes stored in Azure Cognitive Search is visible in the search service
47+
dashboard on the [Azure portal](https://portal.azure.com/). To view the indexes by name, click the Index tile.
48+
Alternatively, you can also get a list of the indexes by name using the [listIndexNames() method](https://docs.microsoft.com/java/api/com.azure.search.documents.indexes.searchindexclient.listindexnames?view=azure-java-stable).
49+
50+
If this error occurs during document upload, it indicates that you've exceeded your quota on the number of documents per
51+
index. You must either create a new index or upgrade for higher capacity limits.
52+
53+
## Unexpected Search Query Results
54+
55+
A common class of issues when using the Search SDK is that the result set of a search query is different from what is expected.
56+
For such cases, you should start by running the search query in the portal to rule out any service-side issues with the
57+
search query or any parameter(s). Review the [OData syntax](https://docs.microsoft.com/azure/search/query-odata-filter-orderby-syntax),
58+
if any, used in the query.
59+
60+
Once the result looks good in the portal, use that as the template to populate the objects and parameters in the search
61+
request APIs. You should also verify that the correct set of documents have been indexed and are being searched on the
62+
service side. One tip would be to start with a 'broad' query (one that returns a superset of desired results, possibly
63+
by giving a large value for or entirely removing, some [query parameters](https://docs.microsoft.com/rest/api/searchservice/search-documents#query-parameters))
64+
and then progressively refining the query till it expresses the desired intent.
65+
66+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fsearch%2Fazure-search-documents%2FTROUBLESHOOTING.png)

0 commit comments

Comments
 (0)