6

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.

Ryan Fisch
  • 2,614
  • 5
  • 36
  • 57

2 Answers2

12

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

alexroussos
  • 2,671
  • 1
  • 25
  • 38
2

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

<batch>
    <delete id="4e41b5a6f3d94aa4891ab8f9abca94e6" />
</batch>
Dens
  • 459
  • 6
  • 7