Deleting document by query

Use this API to delete documents matching a given query or search template.

Requirement: OpenSearchServer v1.5

Call parameters

URL: /services/rest/index/{index_name}/document/

Method: DELETE


  • Accept (optional returned type): application/json OR application/xml

URL parameters:

  • index_name (required): The name of the index.

Query parameters:

  • template : The name of a search request.
  • query : A query pattern.

Success response

The document has been deleted.

HTTP code:

Content (application/json):

    "successful": true,
    "info": "2 document(s) deleted"

Error response

The deletion failed. The reason is provided in the content.

HTTP code:
404, 500

Sample call

Using CURL:

curl -XDELETE \  

View/edit on GitHub

comments powered by Disqus