Add includedPaths and queryPaths to the oak:QueryIndexDefinition node (e.g. /oak:index/customIndex) on all custom indexes to constrain the index. This will make it so the index only handles queries that have the path included (e.g. If the query starts with path /content/mysite - /jcr:root/content/mysite[@foo=1] then includedPaths and queryPaths (String[]) properties would both have a value /content/mysite