Right after uploading a document on Azure Search, can I delete it?

Max :

1) Suppose I use the Azure Search API to upload a new document:

POST /indexes/[index name]/docs/index?api-version=[api-version]  

2) I get a response with an HTTP code 201 (document was successfully created)

3) I use the API again to DELETE to newly uploaded document

Can I be 100% sure that the document will be eventually deleted? Or will it fail if the indexing process has not complete?

Ishan Srivastava :

I work on the Azure Search team. Once you get a success code (HTTP 201) from the indexing API it implies that the document has been indexed successfully. This means that the document exists in the internal data structures and can be deleted. The indexed document might not be available for searching immediately as that requires an internal refresh of the index.

Deletion is lazy i.e. documents are first marked for delete and eventually removed from the index for performance. This means that the deleted documents might still show up in search results for a few seconds after executing the delete. I hope this answers your question.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=146919&siteId=1