[Solved] Es delete all the data in the index without deleting the index structure, including curl deletion

Scenario: if you want to delete only the data under the index without deleting the index structure, there is no postman tool in the (Windows Environment) server

First, only delete all the data in the index without deleting the index structure

POST 192.168.100.88:9200/my_index/_delete_by_query


get
{
  "query": {
    "match_all": {}
  }
}


Notes:
where my_index is the index name

Second, delete the specified data in the index without deleting the index structure

HEADER
DELETE 192.168.100.88:9200/log_index/log_type/D8D1D480190945C2A50B32D2255AA3D3



Notes.
where log_index is the index name, log_type is the index type, and D8D1D480190945C2A50B32D2255AA3D3 is the document id




Third: delete all data and index structure

DELETE 192.168.100.88:9200/my_index


Notes.
where my_index is the index name

Curl deletion in Windows

First, delete all data, including index structure

curl  -X DELETE "http://192.168.100.88:9200/my_index"

Second: delete all data without deleting index structure

curl  -XPOST "http://192.168.100.88:9200/log_index/_delete_by_query?pretty=true" -d "{"""query""":{"""match_all""": {}}}"

Among them: note when using curl (double quotation marks must be used in Windows Environment), single quotation mark will report the following error

“‘http” not supported or disabled in libcurl

C:\Users\admin>curl  -X DELETE 'http://192.168.100.88:9200/my_index'
curl: (1) Protocol "'http" not supported or disabled in libcurl

Read More: