Vulnerability in EPiServer.Forms
I'm currently indexing a custom object in my episerver find instance which looks like this:
var myObject = new MyCustomObject
MyCustomFieldOne = "foo",
MyCustomFieldTwo = "bar"
My question is, what's the most efficient way to then programtically delete all instances of this object in the find index later, as a bulk operation?
I think just calling Delete method is the standard approach https://world.optimizely.com/documentation/developer-guides/search-navigation/NET-Client-API/Deleting-documents/
Problem with the Delete() method though is that it requires an Id parameter.
So to achieve that I'd need to write a query that gets all of the Find Ids of MyCustomObject, and then deletes them one-by-one.
I was wondering if there was a more efficient way to do this as a bulk operation. It would be tricky for me to retreieve all of the ids of MyCustomObject, as there are > 1000 instances (and Find only returns 1000 results at a time, max).
Why can't you use the built in UI to clear the index and then perform and re-index?
Easiest way is to do as Scott suggested, to remove items using query:
client.Delete<MyCustomObject>(x => x.Id.Exists());