Migrating from Lucene 10.x to Lucene 11.0
Java 25 requirement
Lucene 11.0 drops support for all JDK versions below 25. All security manager andjava.security-related code has also been removed, as it is effectively dead in Java 24+.
Relaxed index upgrade policy
Starting with Lucene 11.0.0, the index upgrade policy has been relaxed to allow safe upgrades across multiple major versions without reindexing, as long as no format breaks occur (GITHUB#13797).What changed
Version.MIN_SUPPORTED_MAJORis now manually maintained rather than auto-computed asLATEST.major - 1.- It is set to 10 for Lucene 11.0.0, meaning indexes created with Lucene 10.x can be opened directly.
MIN_SUPPORTED_MAJORwill only be incremented when actual incompatible format changes are introduced.
Two-tier version policy
The upgrade policy works at two levels:- Index opening policy — an index can be opened if its creation version is >=
MIN_SUPPORTED_MAJOR. - Codec reader policy — segments can only be read directly if they were written by the current or previous major version.
Upgrade scenarios
Scenario 1: No format breaks (wider upgrade span)
Scenario 1: No format breaks (wider upgrade span)
MIN_SUPPORTED_MAJOR stays at or below 10.- Simply open the index with the new version; segments are upgraded gradually through normal merging.
- Optionally call
forceMerge()or useUpgradeIndexMergePolicyto rewrite all segments to the latest format immediately.
MIN_SUPPORTED_MAJOR is bumped above 10, an index with a creation version of 10 becomes unopenable and must be reindexed.Scenario 2: Format breaks occur
Scenario 2: Format breaks occur
MIN_SUPPORTED_MAJOR will be bumped. Indexes created before the new minimum will throw IndexFormatTooOldException. Full reindexing is required.Scenario 3: After consuming your upgrade
Scenario 3: After consuming your upgrade
MIN_SUPPORTED_MAJOR above 10, the index becomes unopenable. You must reindex to continue using newer Lucene versions.Opening and upgrading an index
MIN_SUPPORTED_MAJOR (reindex required) or whether segments are too old to read directly (sequential upgrade required).
Breaking API changes
PriorityQueue.remove() removed (GITHUB#15309)
PriorityQueue.remove() removed (GITHUB#15309)
remove(), implement it yourself in a subclass. The heap internals — size, upHeap, and downHeap — are protected members of PriorityQueue and are accessible from subclasses.TieredMergePolicy.setMaxMergeAtOnce() removed (GITHUB#14165)
TieredMergePolicy.setMaxMergeAtOnce() removed (GITHUB#14165)
setMaxMergeAtOnce or getMaxMergeAtOnce from your code.SortField.setMissingValue() removed (GITHUB#15486)
SortField.setMissingValue() removed (GITHUB#15486)
DocIdSet.all and DocIdSet.bits removed (GITHUB#14288, GITHUB#14290)
DocIdSet.all and DocIdSet.bits removed (GITHUB#14288, GITHUB#14290)
- Replace uses of
DocIdSet#allwithDocIdSetIterator.all(maxDoc). - Remove any calls to
DocIdSet#bits; theBitsview of aDocIdSetis no longer part of the public API.
CheckIndex deprecated parameters removed (GITHUB#11023)
CheckIndex deprecated parameters removed (GITHUB#11023)
-slow and -fast parameters for the CheckIndex command-line tool have been removed.The former -fast behaviour (checksum checks only) is now the default. Use the new -level X parameter to control check depth:| Level | Checks performed |
|---|---|
1 (default) | Checksum checks only |
2 | Level 1 checks plus logical integrity checks |
3 | Level 2 checks plus slow checks |
Operations.concatenate/union two-arg variants removed (GITHUB#15762)
Operations.concatenate/union two-arg variants removed (GITHUB#15762)
Operations.concatenate(Automaton, Automaton) and Operations.union(Automaton, Automaton) have been removed.Use the List or Collection variants instead:Operations.complement() and Operations.minus() deprecated
Operations.complement() and Operations.minus() deprecated
complement() can be slow and is not recommended for production use. minus() has been moved to AutomatonTestUtil.minus() for testing purposes only. Migrate away from both methods before upgrading to Lucene 12.Compound file configuration API moved (GITHUB#15295)
Compound file configuration API moved (GITHUB#15295)
CompoundFormat. The old ratio-based threshold has been replaced with fixed size and document-count thresholds.Default thresholds are:- 64 MB for size-based merge policies (e.g.,
TieredMergePolicy) - 65,536 documents for document-count-based merge policies (e.g.,
LogDocMergePolicy)
Query caching disabled by default (GITHUB#14187)
Query caching disabled by default (GITHUB#14187)
Dutch stemmer replaced (Snowball upgrade)
Dutch stemmer replaced (Snowball upgrade)
DutchStemmer— now the Kraaij-Pohlmann stemmer.Dutch_porterStemmer— the originalDutchStemmerfrom Lucene 10 and earlier.
DutchStemmer with Dutch_porterStemmer in your analyzer configuration.DataInput.readGroupVInt() optimization hook removed (GITHUB#15116)
DataInput.readGroupVInt() optimization hook removed (GITHUB#15116)
DataInput that overrides readGroupVInt() must remove that override.Instead, ensure that subclasses of IndexInput implement RandomAccessInput. Pure DataInput subclasses cannot be optimized because they cannot offer random access and seeking.MatchAllDocs and MatchNoDocs are singletons
MatchAllDocs and MatchNoDocs are singletons
MatchAllDocsQuery and MatchNoDocsQuery should now be obtained via their INSTANCE field rather than constructing new objects. The constructors are deprecated and will be removed in a future release.Migrating from Lucene 9.x to Lucene 10.0
For the Lucene 9 → 10 migration, key changes included the removal of deprecated stored-fields APIs, the introduction ofCollectorManager as the preferred search API, records-based data classes, the replacement of IOContext flags with ReadAdvice, and the removal of TimeLimitingCollector.
Refer to the full MIGRATE.md in the source repository for the complete list of changes across all major versions.