Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete Document from AWS CloudSearch

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: enter image description here

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.

like image 693
Ryan Fisch Avatar asked Jul 22 '14 23:07

Ryan Fisch


2 Answers

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).

like image 128
alexroussos Avatar answered Sep 19 '22 19:09

alexroussos


you can use simple xml file. (file extension should .XML)

<batch>
    <delete id="4e41b5a6f3d94aa4891ab8f9abca94e6" />
</batch>
like image 40
Dens Avatar answered Sep 21 '22 19:09

Dens