deleteBy only works with "objectID" key, not others

HI together,

what I try is to remove objects from the index using the deleteBy-method with filters.
I followed the guide at https://www.algolia.com/doc/api-reference/api-methods/delete-by/

index.deleteBy({filters: 'myProperty:"value"'})

this is simply not working, though I got something like a success-message:

[ { updatedAt: '2020-02-06T15:23:34.935Z', taskID: 9929416320 } ]

I tried any other property and at least I tried using the objectID-property, which seamlessly worked as I expected the deleteBy method to work:

index.deleteBy({filters: 'objectID:"123456789"'})

I used my admin key and created a new one with deleteIndex acl activated.
I can create index-objects programatically and delete them by objectID only.

Is there any hidden setting, parameter I oversaw?

Thank you guys!

For the deleteBy query to work, you need to have the field you’re trying to filter on as part of the attributesForFaceting.
This enables the attribute to be filtered upon, allowing the deleteBy to function as expected.

1 Like

Quick, short, working answer!
You should consider putting that info into docs…
Thanks, guys! :wink:

2 Likes