Search code examples
marklogicmarklogic-10

Start reindexing programmatically


We have a screen in our web application where the user can select a list of XPaths for which he wants to create Path range indexes.

We are looking for a way to start reindexing by using REST/Java/XQuery(auto reindexing is disabled). this reindexing will be triggered when the user clicks on the Reindex button provided in my web application.

We are using MarkLogic v10.


Solution

  • You should be able to call the Management REST endpoint to kick off a reindex:

    https://docs.marklogic.com/REST/POST/manage/v2/databases/[id-or-name]#ReindexDB

    Alternatively, you could enable automatic-reindexing prior to adding the new indexes:

    https://docs.marklogic.com/REST/PUT/manage/v2/databases/[id-or-name]/properties