Need help to DeleteByQuery in NEST 2.1.1

i need to know if there is a way to delete all docs into one collection using nest 2.1.1,

this code:

elastic.DeleteByQuery<Doc>(del => del
    .Query(q => q


Error 6 No overload for method 'DeleteByQuery' takes 1 arguments D:\tfs\Produzione Documentale\MES\Utilities\TestIndiciFisco\TestIndiciFisco\Form1.cs 1509 12 TestIndiciFisco

elastic is ElasticClient
Doc is the class mapping the index's documents.


NEST 2.x contains the methods for DeleteByQuery but the functionality has been removed from Elasticsearch in 2.x to a separate plugin that must be installed.

If you install the plugin with

bin/plugin install delete-by-query

start your cluster and then change your call to

	d => d.Query(q => q.QueryString(qs=> qs.Query("*")))

It'll work as expected.

For deleting all documents in an index though, it'd be much quicker to just delete the index, and create a new one.

1 Like