lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krishnamurthy, Kannan" <>
Subject Re: Lucene 6.1.0 index upgrade
Date Fri, 10 Nov 2017 20:09:07 GMT
Never mind my previous question, understood what you meant about the impact to norms after
looking at the uses of CreatedMajorVersion in various Similarity classes. It almost looks
re-indexing is the only option here. This will be quite a big change to embrace for the users
of addIndexes(). (

Many thanks Mike.

On 11/10/17, 1:06 PM, "Krishnamurthy, Kannan" <> wrote:

    Will the norms still be a concern if the 6.1.0 index was upgraded using the IndexUpgrader?
If not would we upgrade first then fake the index creation version to be 7.0.0 ?
    Thanks again.
    From: Michael McCandless <>
    Date: Friday, November 10, 2017 at 6:41 AM
    To: Lucene Users <>, "Krishnamurthy, Kannan" <>
    Subject: Re: Lucene 6.1.0 index upgrade
    OK I'm sorry but I think you'll have to re-index; e.g. how norms are computed and stored
in the index has changed, which means even if you could somehow copy or merge the index over
to the new version, the norms would be incorrect.
    Mike McCandless
    On Thu, Nov 9, 2017 at 6:46 PM, Krishnamurthy, Kannan <<>>
    Hi Mike,
    It doesn’t work either, it throws “Cannot merge a segment that has been created with
major version 6 into this index which has been created by major version 7" message. Let me
try it after an upgrade as well. Same code below,
            public void mergeUsingCodecReader() throws IOException {
                      DirectoryReader ir =;
                      SegmentReader air = (SegmentReader)ir.leaves().get(0).reader();
                    IndexWriterConfig config = newIndexWriterConfig();
                    IndexWriter w = new IndexWriter(newEmptyDirectory("target"), config);
                    exception.expectMessage("Cannot merge a segment that has been created
with major version 6 into this index which has been created by major version 7");
    On 11/9/17, 5:07 PM, "Michael McCandless" <<>>
        Maybe try the addIndexes method that takes CodecReader[] instead?  It will
        be somewhat slower, since it fully reads and writes the index, but it
        should work across major versions?
        Mike McCandless
        On Thu, Nov 9, 2017 at 3:59 PM, Krishnamurthy, Kannan <<>>
        > Greetings.
        > We are currently using Lucene 6.1.0, our typical index size is ~ 200GB and
        > we are planning to move to Lucene 7.0.0.
        > Our daily indexing workflow currently uses IndexWriter.addIndexes() to add
        > an index(this will be on Lucene 7.0.0) to a copy of the of the 200GB index.
        > Further it calls IndexWriter.forceMerge(1) to create a single segment. The
        > addIndexes() now doesn't support different versions of index.
        > We are facing an issue in upgrading to Lucene 7.0.0 due to this
        > limitation. We couldn't afford to do full reindex as there about 50
        > different indexes ~ 200GB each.
        > We tried using the LuceneUpgrade tool to upgrade our index to latest
        > version, however the IndexCreatedVersionMajor is still LUCENE_6_1_0.major,
        > This is preventing us calling IndexWriter.addIndexes() post upgrade.
        > I am wondering what are our options to upgrade without doing a full
        > reindex and to continue to use IndexWriter.addIndexes() post upgrade.
        > The code snippet below shows the different api calls we make.
        > @Test
        > public void addIndexWith7SegmentToDirectoryOnUpgradedSegment() throws
        > IOException {
        > IndexUpgrader upgrader = new IndexUpgrader(lucene610Dir); // lucene 6.1.0
        > directory 200 GB
        > upgrader.upgrade();
        > IndexWriter w = new IndexWriter(lucene610Dir, newIndexWriterConfig());
        > exception.expect(IllegalArgumentException.class);
        > exception.expectMessage(
        > CoreMatchers.containsString("Cannot use addIndexes(Directory) with
        > indexes that have been created by a different Lucene version"));
        > w.addIndexes(lucene700Dir); // lucene 7.0.0 daily index
        > w.forceMerge(1);
        > w.close();
        > }
        > Let me know if you need more details.
        > Many thanks
        > Kannan.

View raw message