Amazon CloudSearch
Developer Guide (API Version 2011-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Deleting Documents in Amazon CloudSearch

A delete operation specifies a document that you want to remove from a domain's index. Once a document is deleted, it will no longer be searchable or returned in results.

Important

When deleting a document, you must specify a new, larger version number. You do not specify the version that you want to delete. For more information, see Document Versions in Amazon CloudSearch.

When posting SDF updates to delete documents, you have to specify each document that you want to delete. If you want to start over with an empty domain that has the same configuration, you can use the console to clone the domain. For more information, see Cloning an Existing Domain's Indexing Options.

If your domain has scaled up to accommodate your index size and you delete a large number of documents, the domain scales down the next time the full index is rebuilt. While this is periodically done automatically, to scale down as quickly as possible you can explicitly rebuild the index when you are done deleting documents.

Note

To delete documents, you upload SDF batches that contain delete operations. You are billed for the total number of document batches uploaded to your search domain, including batches that contain delete operations. For more information about Amazon CloudSearch pricing, see aws.amazon.com/cloudsearch/pricing/.

To delete a document from a search domain

  1. Specify a delete operation in your SDF data that contains the id of the document you want to remove and an updated document version number. The version number must be greater than the document's current version number for the document to be deleted. For example, the following operation would remove version 1 of document tt0484575:

    [                      
     { "type": "delete",
      "id":   "tt0484575",
      "version": 2
     }
    ]
  2. Send the SDF data to your domain. You can submit data updates through the Amazon CloudSearch console, using the cs-post-sdf command, or by posting a request directly to the domain's document service endpoint. For more information, see Uploading Data to an Amazon CloudSearch Domain.