0
votes

If I don't have the key-attribute values but can hit a global secondary index, must I project the key-values into the GSI and then use that/those with the normal key-based delete (DeleteItem) afterward?

Clearly pruning an item from the table will induce any corresponding records to be removed from any secondary indices, so my [faulty?] assumption was the delete could work in reverse (delete in the GSI induces a delete on the table).

1

1 Answers

-1
votes

As of now, you cannot delete items from GSI, In order to remove an item from the GSI it needs to be removed from the main table.

By default, the keys(hash or hash & range) are always projected into your index so you have to collect and pass those attributes in order to delete it.

If you look the indexes are just the images of the table which are just read-only.

To conclude, You cannot delete from an index and reflect in the main table.