Delete keys from many sets in one request

Hi everyone, I am currently using the Aerospike REST Client (https://www.aerospike.com/apidocs/rest) and am trying to figure out how I can remove keys from multiple sets using just one request. As far as I know, you can send many commands at once through the request /v1/operate/{namespace}/{set}/{key}, and {‘operation’: ‘DELETE’} in json (https://www.aerospike.com/apidocs/rest#operateNamespaceSetKey), but how to specify that this should be done in several sets? Thanks in advance for your reply.

I don’t think it is possible, at least with a single API call. Having said that, a background operate scan with an expression filter should be able to do such delete across different records / sets.

As Meher said, using Expressions you can scan the namespace and filter for set name A or set name B or … and with that approach you can hit multiple sets at once, ignoring records from other sets. You can apply a background operate with a delete, as you suggested, with this filter in front.

However, the REST client hasn’t yet implemented Expressions (see the Client Matrix), so you could do that with a client that has, if you need this now. All the clients are gradually implementing this new functionality. Also, be aware that Expressions were introduced with Aerospike Database 5.2.

Reading this again, I get that you’re not exactly asking to delete all records in multiple sets, rather you want to batch delete specific keys. We currently don’t have batch delete or batch operate. It’s a requested feature we may get to later. What we have is batch reads, not batch writes like you would need.

The simplest thing is just to fire a series of delete operation requests at the REST client.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.

By the way, batch writes are coming in Aerospike Database 5.8.