There is a limit to the number of registered queries held in the forest registry. If your application does not account for that fact, you may get unexpected results.
Where is it?
If a specific registered query is not found, then a
cts:search operation with an invalid
cts:registered-query throws an XDMP-UNREGISTERED exception. The XDMP-UNREGISTERED error occurs when a query could not be found in a forest query registry. If a query that had been previously registered can not be found, it may have been discarded automatically. (In the most recent versions of MarkLogic Server at the time of this writing) The forest query registry only contains up to about 48,000 of the most recently used registered queries. If you register more than that, the least recently used ones get discarded.
To avoid registered queries being dropped, it’s a good idea to unregister queries when you know they aren’t needed any more.