IndexDocumentsBatch Class

Represent a batch of update operations for documents in an Azure Search index.

Index operations are performed in the order in which they are added to the batch.

Inheritance
builtins.object
IndexDocumentsBatch

Constructor

IndexDocumentsBatch()

Methods

add_delete_actions

Add documents to delete to the Azure search index.

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_documents instead and set the field explicitly to None.

Delete operations are idempotent. That is, even if a document key does not exist in the index, attempting a delete operation with that key will result in a 200 status code.

add_merge_actions

Add documents to merge in to existing documents in the Azure search index.

Merge updates an existing document with the specified fields. If the document doesn't 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.

add_merge_or_upload_actions

Add documents to merge in to existing documents in the Azure search index, or upload if they do not yet exist.

This action 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.

add_upload_actions

Add documents to upload to the Azure search index.

An upload action is similar to an "upsert" where the document will be inserted if it is new and updated/replaced if it exists. All fields are replaced in the update case.

dequeue_actions

Get the list of currently configured index actions and clear it.

enqueue_actions

Enqueue a list of index actions to index.

add_delete_actions

Add documents to delete to the Azure search index.

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_documents instead and set the field explicitly to None.

Delete operations are idempotent. That is, even if a document key does not exist in the index, attempting a delete operation with that key will result in a 200 status code.

add_delete_actions(*documents: List[Dict] | List[List[Dict]], **kwargs: Any) -> List[IndexAction]

Parameters

Name Description
documents
Required
dict or list[dict]

Documents to delete from an Azure search index. May be a single list of documents, or documents as individual parameters.

Returns

Type Description

the added actions

add_merge_actions

Add documents to merge in to existing documents in the Azure search index.

Merge updates an existing document with the specified fields. If the document doesn't 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.

add_merge_actions(*documents: List[Dict] | List[List[Dict]], **kwargs: Any) -> List[IndexAction]

Parameters

Name Description
documents
Required
dict or list[dict]

Documents to merge into an Azure search index. May be a single list of documents, or documents as individual parameters.

Returns

Type Description

the added actions

add_merge_or_upload_actions

Add documents to merge in to existing documents in the Azure search index, or upload if they do not yet exist.

This action 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.

add_merge_or_upload_actions(*documents: List[Dict] | List[List[Dict]], **kwargs: Any) -> List[IndexAction]

Parameters

Name Description
documents
Required
dict or list[dict]

Documents to merge or upload into an Azure search index. May be a single list of documents, or documents as individual parameters.

Returns

Type Description

the added actions

add_upload_actions

Add documents to upload to the Azure search index.

An upload action is similar to an "upsert" where the document will be inserted if it is new and updated/replaced if it exists. All fields are replaced in the update case.

add_upload_actions(*documents: List[Dict] | List[List[Dict]]) -> List[IndexAction]

Parameters

Name Description
documents
Required
dict or list[dict]

Documents to upload to an Azure search index. May be a single list of documents, or documents as individual parameters.

Returns

Type Description

the added actions

dequeue_actions

Get the list of currently configured index actions and clear it.

dequeue_actions(**kwargs: Any) -> List[IndexAction]

Returns

Type Description

the current actions

enqueue_actions

Enqueue a list of index actions to index.

enqueue_actions(new_actions: IndexAction | List[IndexAction], **kwargs: Any) -> None

Parameters

Name Description
new_actions
Required

the actions to enqueue

Attributes

actions

The list of currently index actions to index.

Returns

Type Description