Loading TOC...

DELETE /v1/search

Summary

Remove documents in a collection or directory, or clear the database.

URL Parameters
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.
txid? The transaction identifier of the multi-statement transaction in which to service this request. Use the /transactions service to create and manage multi-statement transactions.
collection? Remove documents in the named collection.
directory? Remove documents in the named directory.

Response

Upon success, MarkLogic Server returns a status 204.

Required Privileges

Deleting a directory or collection requires the rest-writer role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Clearing the database requires the rest-admin role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-admin

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

A request with no parameters removes all documents in all non-replica forests attached to the content database. The rest-admin role is required for this operation. If the requesting user does not have the required role, a 400 status is returned.

All other requests must supply either one directory or one collection. All matching documents in the directory or collection are deleted.

A request to remove selected documents, rather than a full database clear, requires the rest-writer role, and must include at least one collection or directory parameter.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.