How you schedule the query in MarkLogic?
You can schedule the task or query through the schedule task page inside the Group page. You can schedule you to task daily, monthly, once, hour, etc as per requirement.
please see the below snippets for your response.
Also, you can schedule the task with the help admin function (admin:group-add-scheduled-task).
Below are the functions to schedule a query basis on the requirement.
- admin:group-hourly-scheduled-task
- admin:group-minutely-scheduled-task
- admin:group-daily-scheduled-task
- admin:group-weekly-scheduled-task
- admin:group-monthly-scheduled-task
Xquery Code:
xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
let $config := admin:get-configuration()
let $task := admin:group-hourly-scheduled-task(
"/schedule.xqy",
"/Docs",
2,
30,
xdmp:database("Documents"),
0,
xdmp:user("Jim"),
0)
let $addingTask := admin:group-add-scheduled-task($config, admin:group-get-id($config, "Default"), $task)
return admin:save-configuration($addTask)
Comments
Post a Comment