@@ -8,27 +8,30 @@ menuitem: delete-by-query
88
99# Delete by Query
1010
11- this. ConnectedClient.DeleteByQuery<ElasticSearchProject >(q => q.Term(f => f.Name, "elasticsearch.pm"));
11+ ConnectedClient.DeleteByQuery<object >(q => q.Query(rq => rq. Term(f => f.Name, "elasticsearch.pm") ));
1212
1313Elasticsearch allows you to delete over multiple types and indexes, so does NEST.
1414
15- this. ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
16- .Indices(new[] { "index1", "index2" })
17- .Term(f => f.Name, "elasticsearch.pm")
15+ ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
16+ .Indices(new[] {"index1", "index2"})
17+ .Query(rq => rq. Term(f => f.Name, "elasticsearch.pm") )
1818 );
1919
2020As always ` *Async ` variants are available too.
2121
2222You can also delete by query over all the indices and types:
2323
24- this. ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
24+ ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
2525 .AllIndices()
26- .Term(f => f.Name, "elasticsearch.pm")
26+ .Query(rq => rq. Term(f => f.Name, "elasticsearch.pm") )
2727 );
2828
2929The DeleteByQuery can be further controlled by passing a ` DeleteByQueryParameters ` object
3030
31- this.ConnectedClient.DeleteByQuery<ElasticSearchProject>(
32- q => q.Term(f => f.Name, "elasticsearch.pm")
33- , new DeleteByQueryParameters { Consistency = Consistency.Quorum, Replication = Replication.Sync, Routing = "NEST" }
31+ ConnectedClient.DeleteByQuery<ElasticSearchProject>(q => q
32+ .Query(rq => rq
33+ .Term(f => f.Name, "elasticsearch.pm"))
34+ .Routing("nest")
35+ .Replication(ReplicationOptions.Sync)
3436 );
37+
0 commit comments