Skip to content

Commit a60be8e

Browse files
committed
Renamed the feature flag that controls when default Lucene posting format is used.
Addressed comment from #126080
1 parent ccc3121 commit a60be8e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

server/src/main/java/org/elasticsearch/index/codec/Elasticsearch900Lucene101Codec.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929
public class Elasticsearch900Lucene101Codec extends CodecService.DeduplicateFieldInfosCodec {
3030

31+
public static final PostingsFormat DEFAULT_POSTINGS_FORMAT = new Lucene101PostingsFormat();
32+
3133
private final StoredFieldsFormat storedFieldsFormat;
3234

3335
private final PostingsFormat defaultPostingsFormat;
@@ -66,7 +68,7 @@ public Elasticsearch900Lucene101Codec() {
6668
public Elasticsearch900Lucene101Codec(Zstd814StoredFieldsFormat.Mode mode) {
6769
super("Elasticsearch900Lucene101", new Lucene101Codec());
6870
this.storedFieldsFormat = mode.getFormat();
69-
this.defaultPostingsFormat = new Lucene101PostingsFormat();
71+
this.defaultPostingsFormat = DEFAULT_POSTINGS_FORMAT;
7072
this.defaultDVFormat = new Lucene90DocValuesFormat();
7173
this.defaultKnnVectorsFormat = new Lucene99HnswVectorsFormat();
7274
}

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.apache.lucene.codecs.DocValuesFormat;
1313
import org.apache.lucene.codecs.KnnVectorsFormat;
1414
import org.apache.lucene.codecs.PostingsFormat;
15-
import org.apache.lucene.codecs.lucene101.Lucene101PostingsFormat;
1615
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat;
1716
import org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat;
1817
import org.elasticsearch.common.util.BigArrays;
@@ -34,13 +33,12 @@
3433
* vectors.
3534
*/
3635
public class PerFieldFormatSupplier {
37-
public static final FeatureFlag USE_LUCENE101_POSTINGS_FORMAT = new FeatureFlag("use_lucene101_postings_format");
36+
public static final FeatureFlag USE_DEFAULT_LUCENE_POSTINGS_FORMAT = new FeatureFlag("use_default_lucene_postings_format");
3837

3938
private static final DocValuesFormat docValuesFormat = new Lucene90DocValuesFormat();
4039
private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat();
4140
private static final ES819TSDBDocValuesFormat tsdbDocValuesFormat = new ES819TSDBDocValuesFormat();
4241
private static final ES812PostingsFormat es812PostingsFormat = new ES812PostingsFormat();
43-
private static final Lucene101PostingsFormat lucene101PostingsFormat = new Lucene101PostingsFormat();
4442
private static final PostingsFormat completionPostingsFormat = PostingsFormat.forName("Completion101");
4543

4644
private final ES87BloomFilterPostingsFormat bloomFilterPostingsFormat;
@@ -53,10 +51,10 @@ public PerFieldFormatSupplier(MapperService mapperService, BigArrays bigArrays)
5351
this.bloomFilterPostingsFormat = new ES87BloomFilterPostingsFormat(bigArrays, this::internalGetPostingsFormatForField);
5452

5553
if (mapperService != null
56-
&& USE_LUCENE101_POSTINGS_FORMAT.isEnabled()
54+
&& USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
5755
&& mapperService.getIndexSettings().getIndexVersionCreated().onOrAfter(IndexVersions.USE_LUCENE101_POSTINGS_FORMAT)
5856
&& mapperService.getIndexSettings().getMode() == IndexMode.STANDARD) {
59-
defaultPostingsFormat = lucene101PostingsFormat;
57+
defaultPostingsFormat = Elasticsearch900Lucene101Codec.DEFAULT_POSTINGS_FORMAT;
6058
} else {
6159
// our own posting format using PFOR
6260
defaultPostingsFormat = es812PostingsFormat;

server/src/test/java/org/elasticsearch/index/codec/PerFieldMapperCodecTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void testUseBloomFilter() throws IOException {
9494
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(ES87BloomFilterPostingsFormat.class));
9595
assertThat(perFieldMapperCodec.useBloomFilter("another_field"), is(false));
9696

97-
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_LUCENE101_POSTINGS_FORMAT.isEnabled()
97+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
9898
&& timeSeries == false ? Lucene101PostingsFormat.class : ES812PostingsFormat.class;
9999
assertThat(perFieldMapperCodec.getPostingsFormatForField("another_field"), instanceOf(expectedPostingsFormat));
100100
}
@@ -110,7 +110,7 @@ public void testUseBloomFilterWithTimestampFieldEnabled() throws IOException {
110110
public void testUseBloomFilterWithTimestampFieldEnabled_noTimeSeriesMode() throws IOException {
111111
PerFieldFormatSupplier perFieldMapperCodec = createFormatSupplier(true, false, false);
112112
assertThat(perFieldMapperCodec.useBloomFilter("_id"), is(false));
113-
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_LUCENE101_POSTINGS_FORMAT.isEnabled()
113+
Class<? extends PostingsFormat> expectedPostingsFormat = PerFieldFormatSupplier.USE_DEFAULT_LUCENE_POSTINGS_FORMAT.isEnabled()
114114
? Lucene101PostingsFormat.class
115115
: ES812PostingsFormat.class;
116116
assertThat(perFieldMapperCodec.getPostingsFormatForField("_id"), instanceOf(expectedPostingsFormat));

0 commit comments

Comments
 (0)