ElasticSearch and NEST: How do you purge all documents from an index?

后端 未结 4 731
无人及你
无人及你 2021-01-07 23:06

I know how to delete an entire ElasticSearch index, but how do you purge all documents from an index?

My Motivation: I\'d like to have a \"ReIndex\" method that purg

4条回答
  •  囚心锁ツ
    2021-01-07 23:28

    **To delete all Records -**
    client.DeleteByQuery(del => del
                .Query(q => q.QueryString(qs=>qs.Query("*"))
            ));
    **To delete index-**
    client.DeleteIndex(d => d.Index("index_name"));
    

提交回复
热议问题