Try our conversational search powered by Generative AI!

Remove specific object types from Episerver find



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?

Dec 13, 2021 19:00
Dec 13, 2021 22:11

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

Dec 14, 2021 10:02
Scott Reed - Dec 14, 2021 15:03
There's multiple method, you can just writing a matching criteria such as the second example in the posted link. So just write a lambda that always matches true like where ID > 0 or something

Hi FalconX,

Why can't you use the built in UI to clear the index and then perform and re-index?



Dec 14, 2021 14:27
- Dec 20, 2021 7:33
It might not be an option since he is indexing custom objects.

Easiest way is to do as Scott suggested, to remove items using query:

client.Delete<MyCustomObject>(x => x.Id.Exists());
Dec 20, 2021 7:35
Scott Reed - Dec 20, 2021 9:42
Thanks Mari, exactly!!
FalconX - Dec 20, 2021 10:15
Ah yes, so simple, thank you!! :D
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.