Area: Episerver Find
Applies to versions: 12 and higher
Other versions:

Deleting documents

This topic explains how to delete documents from an index, using the Client interface in the .NET Client API for Episerver Find.

How it works

You can delete individual documents from the index using the IClient interface's Delete method. For example, the code below deletes a BlogPost with ID 42.


You can delete all documents that match criteria defined in a filter expression. For example, the code below deletes all documents of type BlogPost, as well as those of a type inheriting from BlogPost that are tagged with "Banana".

client.Delete<BlogPost>(x => x.Tags.Match("Banana"));

Deleting documents from the recycle bin

When deleting documents from the recycle bin, make sure that you are only deleting if the document returns shouldIndex=true for CheckPublishedStatus && DisableIndexing. In this way, you avoid many 404 errors that occur when Find tries to delete an unindexed document from the recycle bin.

Last updated: Oct 31, 2016