Is there an easy way to delete all the element range indexes on a given database?
Thanks
Posted by Roy Tang under notes at
#marklogic
#questions
#stackoverflow
#software development
Also on: stackexchange / 2
Also on: stackexchange / 2
On This Site
Things I Write About
You could write some script to do this, for example in JavaScript which you need to execute from your Query Console:
The above goes through all the Element Range Indexes for the ‘Documents’ database and removes them - including any pre-defined Range Indexes for DLS.
I believe you can do this using the REST Management API method
PUT /manage/v2/databases/{dbid}/properties
. If you pass a payload in which therange-element-indexes
property is empty, I think it removes any existing ones.Take a look at the following:
http://docs.marklogic.com/REST/PUT/manage/v2/databases/[id-or-name]/properties
You’d want to use a payload similar to the following for XML:
Or like this for JSON:
Be careful, though: It’s a sharp tool. You’ll also delete pre-defined indexes like the ones for DLS. I think that’s also true of Tamas’ solution, but did not confirm.