How to optimize Oak Lucene indexes to reduce indexing time

Description

Optimize the AEM Oak lucene indexes to reduce reindexing time.


Environment


AEM 6.0 + Oak 1.0.16 or later AEM 6.1 and AEM 6.2

Resolution

You can optimize the Oak Lucene indexes by fine tuning the oak: QueryIndexDefinition with properties such as “includedPaths”, “excludedPaths”, “name” and “indexPath”.

  • “includedPaths” and “excludedPaths” properties restrict what paths the index traverses when reindexing and which paths it listens to for index updates.
  • “name” and “indexPath” properties make index logs easier to understand as it would tag the log messages with the path or name of the index.  For example:
30.01.2017 14:07:12.934 *DEBUG* pool-8-thread-2 org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditor damassetlucene(``/oak``:index``/damAssetLucene``) = Indexed 9000 nodes...

Steps to optimize the indexes:

  1. Go to http://aem-host:port/crx/de/index.jsp and log in as admin
  2. Browse to /oak:index
  3. Add the properties highlighted below 1 to the corresponding indexes.  The includedPaths and excludedPaths properties should be multi-value String ( String )
  4. Click “Save All” in CRXDe

1 /oak:index property modifications

"authorizables"``: {

    ``"includedPaths"``:``"/home"``,

    ``"reindexCount"``: 1,

    ``"name"``: ``"authorizables"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/authorizables"

    ``},



"cqPageLucene"``: {

    ``"includedPaths"``:

      ``"/content"``,

      ``"/etc"

    ``,

    ``"reindexCount"``: 1,

    ``"name"``: ``"cq:Page"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/cqPageLucene"

    ``},



"cqTagLucene"``: {

    ``"reindexCount"``: 1,

    ``"name"``: ``"cqTag"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"excludedPaths"``:

      ``"/var"``,

      ``"/tmp"``,

      ``"/etc/replication"``,

      ``"/etc/workflow/instances"``,

      ``"/jcr:system"

    ``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/cqTagLucene"

    ``},



"damAssetLucene"``: {

    ``"includedPaths"``:``"/content/dam"``,

    ``"evaluatePathRestrictions"``: ``true``,

    ``"reindexCount"``: 1,

    ``"name"``: ``"damassetlucene"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/damAssetLucene"

    ``},



"lucene"``: {

    ``"reindexCount"``: 1,

    ``"name"``: ``"lucene"``,

    ``"reindex"``: ``false``,

    ``"includePropertyTypes"``:``"String"``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"excludedPaths"``:

      ``"/var"``,

      ``"/tmp"``,

      ``"/etc/replication"``,

      ``"/etc/workflow/instances"``,

      ``"/jcr:system"

    ``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/lucene"

    ``},



"ntBaseLucene"``: {

    ``"reindexCount"``: 1,

    ``"name"``: ``"tags"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"excludedPaths"``:

      ``"/var"``,

      ``"/tmp"``,

      ``"/etc/replication"``,

      ``"/etc/workflow/instances"``,

      ``"/jcr:system"

    ``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/ntBaseLucene"

    ``},





"workflowDataLucene"``: {

    ``"reindexCount"``: 1,

    ``"name"``: ``"workflow"``,

    ``"compatVersion"``: 2,

    ``"reindex"``: ``false``,

    ``"type"``: ``"lucene"``,

    ``"jcr:primaryType"``: ``"oak:QueryIndexDefinition"``,

    ``"excludedPaths"``:

      ``"/var"``,

      ``"/tmp"``,

      ``"/etc/replication"``,

      ``"/jcr:system"

    ``,

    ``"async"``: ``"async"``,

    ``"indexPath"``: ``"/oak:index/workflowDataLucene"

    ``}

On this page