Oak Index Definition Generator for AEM: XPath, SQL2 and QueryBuilder
Paste an AEM query and get the Oak Lucene index that serves it: diff.json for AEM as a Cloud Service or .content.xml for AEM 6.5, with every property setting explained.
Written in December 2026 and checked against the Apache Oak Lucene index documentation and Adobe's Cloud Service indexing guide.
Paste an AEM query and get the Oak Lucene index that serves it: one index rule for the node type, one property definition per condition, and the path the index is limited to. The generator reads XPath, JCR-SQL2 and QueryBuilder, and gives the result as a diff.json entry for Cloud Service or a .content.xml for AEM 6.5. It runs in your browser, so the query stays on your machine.
The generator older AEM posts link to, at oakutils.appspot.com, is gone; Adobe's indexing guide links to the one in Oak Indexing Tools instead, which takes SQL-2 and XPath. This one also reads QueryBuilder predicates and says why each setting is there. Read every definition before you deploy it: the generator works from the query's text, not from your content.
How does each condition become an index setting?
The settings come from the Oak Lucene index documentation:
| In the query | In the property definition |
|---|---|
@x = 'a', [x] = 'a', jcr:like, LIKE | propertyIndex=true |
@x > …, a date or number range | propertyIndex=true and type (Date, Long, Double) |
order by @x | ordered=true, plus type for dates |
[@x], IS NOT NULL | propertyIndex and notNullCheckEnabled |
not(@x), IS NULL | nullCheckEnabled=true |
jcr:contains(@x, …), CONTAINS(s.[x], …) | analyzed=true |
jcr:contains(., …), CONTAINS(s.*, …) | a regex property with nodeScopeIndex=true |
fn:lower-case(@x), LOWER([x]) | function="fn:lower-case(@x)" |
fn:name(), NAME() | indexNodeName=true on the rule |
| a path restriction | includedPaths and queryPaths, with evaluatePathRestrictions=true |
Relative properties keep their path: jcr:content/metadata/@dc:format becomes name="jcr:content/metadata/dc:format" on the dam:Asset rule. For full-text search on a whole page or asset, the generator indexes the properties of jcr:content (pages) or jcr:content/metadata (assets) with a regex name. Text inside PDFs and Office files needs aggregation and Tika, which the product's damAssetLucene index already has.
How do you deploy it on AEM as a Cloud Service?
Adobe's indexing guide describes two ways.
Simplified index management is the one Adobe recommends where it fits. Your definitions go in one file, ui.apps/src/main/content/jcr_root/_oak_index/diff.index/diff.json, next to a placeholder .content.xml, and filter.xml gets <filter root="/oak:index/diff.index"/>. The JSON tab prints an entry for that file. It can't hold an index without includedPaths, or one that covers /apps or /libs.
The legacy format is one folder per index under _oak_index, named <prefix>.<indexName>-<productVersion>-custom-<customVersion>. The prefix is your project's and, per Adobe, two to five characters long; Adobe's example is acme.product-1-custom-2. Each change ships under the next custom version, so the XML tab names the folder -1-custom-1 to start. The package also needs allowIndexDefinitions and noIntermediateSaves set to true.
Both formats have the same rules on Cloud Service: type must be lucene, compatVersion must be 2, and async one of [async], [async,nrt] or [fulltext-async]. The Async menu above offers the first two. Custom analyzers aren't supported.
Should you write a new index or extend an existing one?
For queries on dam:Asset or cq:Page, extend the product index. Two Lucene indexes on the same node type compete for the same queries, and the query engine picks the one with the lower cost estimate, which may not be the one you meant. Copy the property definitions the generator prints into a customized damAssetLucene or cqPageLucene, under that index's own name.
A new index makes sense for your own node types or a path the product indexes don't cover. Use tag selection when you want a query to choose the index explicitly: tick "Select by tag", then add option(index tag acme) to the query.
Finding the query behind a "Traversed N nodes" warning, and reindexing on 6.5, are covered in the guide to AEM traversal warnings.
More in Tools
- Dispatcher Filter Tester
Paste /filter rules and a list of URLs to see which requests get through, which rule decides, and how each URL is split.
- AEM Cron Expression Generator
Build or check a Quartz expression for a Sling scheduled task, with the next run times and the code to register it.