Delete documents of type in Elasticsearch

前端 未结 7 1416
南旧
南旧 2021-02-18 16:50

I want to delete all the documents indexed within a type in Elasticsearch, using the HTTP/REST api, but I don\'t want to delete the mapping for this type

How can I build

7条回答
  •  甜味超标
    2021-02-18 17:37

    Before executing command, index/mapping state; (screenshots taken from elasticsearch head plugin web interface)

    enter image description here

    enter image description here

    enter image description here

    Command;

    curl -XDELETE 'http://localhost:9200/publishercategoryeu/autocomplete/_query' -d '
    {
      "query": {
        "bool": {
          "must": [
            {
              "match_all": {}
            }
          ]
        }
      }
    }
    '
    

    Result;

    enter image description here

    After executing command, index/mapping state;

    enter image description here

    enter image description here

    enter image description here

    As we can see we deleted all the documents indexed within a type(mapping) without delete index or type(mapping).

提交回复
热议问题