I am attempting to delete a single document in AWS CloudSearch using the following batch document:
[{
"type": "delete",
"id": "532177"
}]
but I get the following error from AWS:
and when download the SDF it returns the following:
[
{
type: "add",
id: "delete_img_json",
version: 1406072053,
lang: "en",
fields: {
content: "[{ "type": "delete", "id": "532177" }]",
resourcename: "Delete_IMG.json",
content_encoding: "ISO-8859-2",
content_type: "application/json"
}
}
]
All I am attempting to do is remove a single document from my CloudSearch index.
I get the same error as you when I try to upload a single document that is not part of a batch:
{
"type": "delete",
"id": "4e41b5a6f3d94aa4891ab8f9abca94e6"
}
But it succeeds if it's part of a batch:
[{
"type": "delete",
"id": "4e41b5a6f3d94aa4891ab8f9abca94e6"
}]
I realize that you show a json array in your example above, but it is worth double-checking since you're getting the exact same error you'd get when trying to post a single document that is not part of an array. It would be an easy mistake to make since their own documentation on preparing data for submission shows a partial example where the delete is not part of an array (see the "To delete a document from a search domain" section).
you can use simple xml file. (file extension should .XML)
<batch>
<delete id="4e41b5a6f3d94aa4891ab8f9abca94e6" />
</batch>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With