3

Just Data. The size of the database in the status tab should be 0 MB.
Is there any API that can do the work and what if I try to purge all the directories using unix commands. Is it recommended ?

bosari
  • 1,922
  • 1
  • 19
  • 38

2 Answers2

5

The Admin UI approach mentioned by Kishan will use forest-clear functionality, which you can invoke programmatically as well. That will be done almost instantly, where the document-delete approach would not scale well on large databases.

Try using the xdmp:forest-clear() method like this:

for $forest-id in xdmp:database-forests(xdmp:database())
return xdmp:forest-clear($forest-id)

Note: I would strongly recommend against tampering with MarkLogic data files from file-system, unless guided by MarkLogic Support, or a MarkLogic Expert.

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35
3

From the admin console, go to the particular database configure page. You can see the clear option. Clear will delete all the data in the database.

Alternatively, You can use the following query:

xdmp:document-delete(cts:uris((),(),cts:and-query(()))).

cts:uris((),(),cts:and-query(())) will match all the documents in the database and xdmp:document-delete() will delete those documents.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Kishan Ashra
  • 146
  • 8