Documents - Index
Sends a batch of document write actions to the index.
POST {endpoint}/indexes('{indexName}')/docs/search.index?api-version=2026-04-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
The endpoint URL of the search service. |
|
index
|
path | True |
string |
The name of the index. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Accept |
The Accept header. |
||
| x-ms-client-request-id |
string (uuid) |
An opaque, globally-unique, client-generated string identifier for the request. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| value | True |
The actions in the batch. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Response containing the status of operations for all documents in the indexing request. |
|
| Other Status Codes |
Response containing the status of operations for all documents in the indexing request. |
|
| Other Status Codes |
An unexpected error response. |
Security
api-key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
| Name | Description |
|---|---|
| https://search.azure.com/.default |
Examples
SearchIndexIndexDocuments
Sample request
POST https://exampleservice.search.windows.net/indexes('example-index')/docs/search.index?api-version=2026-04-01
{
"value": [
{
"@search.action": "mergeOrUpload",
"id": "0",
"name": "test",
"description": "test0 hello",
"vector1": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"vector1b": [
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
],
"vector2": [
0,
1,
2,
3,
4
],
"vector3": [
0,
1,
2,
3,
4
],
"vector22": [
20,
21,
22,
23,
24,
25,
26,
27,
28,
29
],
"ownerId": "benny",
"category": "purple",
"price": 0
},
{
"@search.action": "mergeOrUpload",
"id": "1",
"name": "test",
"description": "test1 hello",
"vector1": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"vector1b": [
11,
12,
13,
14,
15,
16,
17,
18,
19,
20
],
"vector2": [
1,
2,
3,
4,
5
],
"vector3": [
1,
2,
3,
4,
5
],
"vector22": [
21,
22,
23,
24,
25,
26,
27,
28,
29,
30
],
"ownerId": "sam",
"category": "purple",
"price": 1
},
{
"@search.action": "mergeOrUpload",
"id": "2",
"name": "test",
"description": "test2 hello",
"vector1": [
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"vector1b": [
12,
13,
14,
15,
16,
17,
18,
19,
20,
21
],
"vector2": [
2,
3,
4,
5,
6
],
"vector3": [
2,
3,
4,
5,
6
],
"vector22": [
22,
23,
24,
25,
26,
27,
28,
29,
30,
31
],
"ownerId": "sam",
"category": "purple",
"price": 2
}
]
}
Sample response
{
"value": [
{
"key": "0",
"status": true,
"statusCode": 201
},
{
"key": "1",
"status": true,
"statusCode": 201
},
{
"key": "2",
"status": true,
"statusCode": 201
}
]
}
{
"value": [
{
"key": "0",
"status": true,
"statusCode": 201
},
{
"key": "1",
"status": true,
"statusCode": 201
},
{
"key": "2",
"status": true,
"statusCode": 201
}
]
}
Definitions
| Name | Description |
|---|---|
| Accept |
The Accept header. |
|
Error |
The resource management error additional info. |
|
Error |
The error detail. |
|
Error |
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). |
|
Index |
Represents an index action that operates on a document. |
|
Index |
The operation to perform on a document in an indexing batch. |
|
Index |
Contains a batch of document write actions to send to the index. |
|
Index |
Response containing the status of operations for all documents in the indexing request. |
|
Indexing |
Status of an indexing operation for a single document. |
Accept
The Accept header.
| Value | Description |
|---|---|
| application/json;odata.metadata=none |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
|
The additional info. |
| type |
string |
The additional info type. |
ErrorDetail
The error detail.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
string |
The error code. |
| details |
The error details. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
ErrorResponse
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
IndexAction
Represents an index action that operates on a document.
| Name | Type | Description |
|---|---|---|
| @search.action |
The operation to perform on a document in an indexing batch. |
IndexActionType
The operation to perform on a document in an indexing batch.
| Value | Description |
|---|---|
| upload |
Inserts the document into the index if it is new and updates it if it exists. All fields are replaced in the update case. |
| merge |
Merges the specified field values with an existing document. If the document does not exist, the merge will fail. Any field you specify in a merge will replace the existing field in the document. This also applies to collections of primitive and complex types. |
| mergeOrUpload |
Behaves like merge if a document with the given key already exists in the index. If the document does not exist, it behaves like upload with a new document. |
| delete |
Removes the specified document from the index. Any field you specify in a delete operation other than the key field will be ignored. If you want to remove an individual field from a document, use merge instead and set the field explicitly to null. |
IndexBatch
Contains a batch of document write actions to send to the index.
| Name | Type | Description |
|---|---|---|
| value |
The actions in the batch. |
IndexDocumentsResult
Response containing the status of operations for all documents in the indexing request.
| Name | Type | Description |
|---|---|---|
| value |
The list of status information for each document in the indexing request. |
IndexingResult
Status of an indexing operation for a single document.
| Name | Type | Description |
|---|---|---|
| errorMessage |
string |
The error message explaining why the indexing operation failed for the document identified by the key; null if indexing succeeded. |
| key |
string |
The key of a document that was in the indexing request. |
| status |
boolean |
A value indicating whether the indexing operation succeeded for the document identified by the key. |
| statusCode |
integer (int32) |
The status code of the indexing operation. Possible values include: 200 for a successful update or delete, 201 for successful document creation, 400 for a malformed input document, 404 for document not found, 409 for a version conflict, 422 when the index is temporarily unavailable, or 503 for when the service is too busy. |