Elastic Index
Oak supports Elasticsearch (Elastic for short) based indexes for both property constraint and full text constraints. Elastic indexes support similar features as Lucene indexes, however there are differences:
- The
typeiselasticsearch. - The index definition needs to be under
/oak:index. Other locations are not supported. - The
asyncproperty needs to be set toelastic-async. Synchronous,nrtor other lanes are not supported. Indexes are updated asynchronously. refreshis ignored. Changes take effect immediately after changing them. Existing documents in Elasticsearch are not changed.- Indexes are NOT automatically built when needed:
They can be built by setting the
reindexproperty totrueor by using theoak-runtool. We recommend to build them using theoak-runtool. evaluatePathRestrictionscannot be disabled. The parent paths are always indexed. Queries with path restrictions are evaluated at index level when possible, otherwise they are evaluated at repository level.codecis ignored.compatVersionis ignored.useIfExistsis ignored.blobSizeis ignored.nameis ignored.indexPathis ignored.analyzerssupport the Lucene configuration plus Elasticsearch specific options. Since Elasticsearch uses a more recent version of Lucene compared to the one inoak-lucenemodule, there might be differences in configuration options that could require changes when migrating from Lucene to Elasticsearch. TheHunspellStemfilter is not supported since dictionary files are required in the Elasticsearch cluster filesystem.useInExcerptdoes not support regexp relative properties.- For property definitions,
syncanduniqueare ignored. Synchronous indexing, and enforcing uniqueness constraints is not currently supported in elastic indexes. - The behavior of
dynamicBoostdiffers slightly between Lucene and Elasticsearch:- Lucene: Boosting is applied at indexing time.
- Elasticsearch: Boosting is applied at query time.
Full-text queries automatically use dynamically boosted values to match relevant results, but this behavior may not always be desirable. To use these values exclusively for influencing relevance without affecting matching, configure the property definition as follows:
{
"dynamicBoost": true,
"useInFullTextQuery": false
}
- The behavior of
suggestis slightly different: For Lucene indexes, the suggestor is updated every 10 minutes by default and the frequency can be changed bysuggestUpdateFrequencyMinutesproperty in suggestion node under the index definition node. In Elastic indexes, there is no such delay and thus no need for the above config property. This is an improvement in ES over lucene.

