Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -671,4 +671,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,9 @@ public void testLoadSyntheticSourceFromStringOrBytesRef() throws IOException {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -657,4 +657,9 @@ protected List<SortShortcutSupport> getSortShortcutSupport() {
new SortShortcutSupport(this::minimalMapping, this::writeField, false)
);
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why are skippers disabled for scaled_float when index=false and doc_values=true? Shouldn't this be similar to half_float?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I just forgot to add them to scaled_float :). I will do that separately.

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -882,4 +882,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,9 @@ public void testAggregationsDocValuesDisabled() throws IOException {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of(new SortShortcutSupport(this::minimalMapping, this::writeField, true));
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of(new SortShortcutSupport(this::minimalMapping, this::writeField, true));
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -709,4 +709,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of(new SortShortcutSupport(this::minimalMapping, this::writeField, false));
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private static Version parseUnchecked(String version) {
public static final IndexVersion TIME_SERIES_ALL_FIELDS_USE_SKIPPERS = def(9_046_0_00, Version.LUCENE_10_3_1);
public static final IndexVersion UPGRADE_TO_LUCENE_10_3_2 = def(9_047_0_00, Version.LUCENE_10_3_2);
public static final IndexVersion SECURITY_MIGRATIONS_METADATA_FLATTENED_UPDATE = def(9_048_0_00, Version.LUCENE_10_3_2);
public static final IndexVersion STANDARD_INDEXES_USE_SKIPPERS = def(9_049_0_00, Version.LUCENE_10_3_2);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ private IndexType indexType() {
if (docValues.get() == false) {
return IndexType.NONE;
}
if (indexSettings.useDocValuesSkipper()
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)) {
return IndexType.skippers();
}
return useTimeSeriesDocValuesSkippers(indexSettings, dimension.get()) ? IndexType.skippers() : IndexType.docValuesOnly();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,15 @@ private Long parseNullValue(DateFieldType fieldType) {
}

private IndexType indexType(String fullFieldName) {
boolean hasDocValuesSkipper = shouldUseDocValuesSkipper(indexSettings, docValues.getValue(), fullFieldName);
if (hasDocValuesSkipper) {
if (shouldUseDocValuesSkipper(indexSettings, docValues.getValue(), fullFieldName)) {
return IndexType.skippers();
}
if (index.get() == false && docValues.get()) {
if (indexSettings.useDocValuesSkipper()
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)) {
return IndexType.skippers();
}
}
if (indexCreatedVersion.isLegacyIndexVersion()) {
return IndexType.archivedPoints();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ private IndexType indexType() {
if (useTimeSeriesDocValuesSkippers(indexSettings, dimension.get())) {
return IndexType.skippers();
}
if (indexed.get() == false && hasDocValues.get()) {
if (indexSettings.useDocValuesSkipper()
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)) {
return IndexType.skippers();
}
}
return IndexType.points(indexed.get(), hasDocValues.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ public KeywordFieldMapper build(MapperBuilderContext context) {

private FieldType resolveFieldType(final boolean forceDocValuesSkipper, final String fullFieldName) {
FieldType fieldtype = new FieldType(Defaults.FIELD_TYPE);
if (forceDocValuesSkipper || shouldUseHostnameSkipper(fullFieldName) || shouldUseTimeSeriesSkipper()) {
if (forceDocValuesSkipper
|| shouldUseHostnameSkipper(fullFieldName)
|| shouldUseTimeSeriesSkipper()
|| shouldUseStandardSkipper()) {
fieldtype = new FieldType(Defaults.FIELD_TYPE_WITH_SKIP_DOC_VALUES);
}
fieldtype.setOmitNorms(this.hasNorms.getValue() == false);
Expand Down Expand Up @@ -469,6 +472,13 @@ private boolean shouldUseHostnameSkipper(final String fullFieldName) {
&& indexSortConfigByHostName(indexSettings.getIndexSortConfig());
}

private boolean shouldUseStandardSkipper() {
return hasDocValues.get()
&& indexed.get() == false
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)
&& indexSettings.useDocValuesSkipper();
}

private static boolean indexSortConfigByHostName(final IndexSortConfig indexSortConfig) {
return indexSortConfig != null && indexSortConfig.hasIndexSort() && indexSortConfig.hasSortOnField(HOST_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,14 @@ private IndexType indexType() {
if (indexSettings.getIndexVersionCreated().isLegacyIndexVersion()) {
return IndexType.archivedPoints();
}
if (indexed.get() == false && hasDocValues.get() && useTimeSeriesDocValuesSkippers(indexSettings, dimension.get())) {
return IndexType.skippers();
if (indexed.get() == false && hasDocValues.get()) {
if (useTimeSeriesDocValuesSkippers(indexSettings, dimension.get())) {
return IndexType.skippers();
}
if (indexSettings.useDocValuesSkipper()
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.STANDARD_INDEXES_USE_SKIPPERS)) {
return IndexType.skippers();
}
}
return IndexType.points(indexed.get(), hasDocValues.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -990,4 +990,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -724,4 +724,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ protected boolean supportsIgnoreMalformed() {
return false;
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}

public void testExistsQueryDocValuesDisabled() throws IOException {
MapperService mapperService = createMapperService(fieldMapping(b -> {
minimalMapping(b);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1780,4 +1780,9 @@ public void testNormsEnabledWhenIndexModeIsTsdb_bwcCheck() throws IOException {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1021,4 +1021,9 @@ public void assertStoredFieldsEquals(String info, IndexReader leftReader, IndexR
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of(new SortShortcutSupport(this::minimalMapping, this::writeField, true));
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,9 @@ private void assertSyntheticVectors(String mapping, BytesReference source, XCont
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1845,4 +1845,45 @@ public final void testSortShortcuts() throws IOException {
}
assertParseMinimalWarnings();
}

protected boolean supportsDocValuesSkippers() {
return true;
}

public void testDocValuesSkippers() throws IOException {
assumeTrue("Mapper does not support doc values skippers", supportsDocValuesSkippers());
IndexVersion preSkipperVersion = IndexVersions.SECURITY_MIGRATIONS_METADATA_FLATTENED_UPDATE;
IndexVersion withSkipperVersion = IndexVersions.STANDARD_INDEXES_USE_SKIPPERS;

Settings skippersDisabled = Settings.builder().put(IndexSettings.USE_DOC_VALUES_SKIPPER.getKey(), false).build();

Settings skippersEnabled = Settings.builder().put(IndexSettings.USE_DOC_VALUES_SKIPPER.getKey(), true).build();

{
MapperService mapperService = createMapperService(preSkipperVersion, fieldMapping(b -> {
minimalMapping(b);
b.field("doc_values", true);
b.field("index", false);
}));
assertThat(mapperService.fieldType("field").indexType(), equalTo(IndexType.docValuesOnly()));
}

{
MapperService mapperService = createMapperService(withSkipperVersion, skippersEnabled, fieldMapping(b -> {
minimalMapping(b);
b.field("doc_values", true);
b.field("index", false);
}));
assertThat(mapperService.fieldType("field").indexType(), equalTo(IndexType.skippers()));
}

{
MapperService mapperService = createMapperService(withSkipperVersion, skippersDisabled, fieldMapping(b -> {
minimalMapping(b);
b.field("doc_values", true);
b.field("index", false);
}));
assertThat(mapperService.fieldType("field").indexType(), equalTo(IndexType.docValuesOnly()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,9 @@ public void testSyntheticSourceKeepArrays() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,9 @@ public void testInvalidOffsets() throws IOException {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2374,4 +2374,9 @@ private void givenModelSettings(String inferenceId, MinimalServiceSettings model
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -623,4 +623,9 @@ protected boolean supportsCopyTo() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of(new SortShortcutSupport(this::minimalMapping, this::writeField, true));
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,9 @@ protected List<SortShortcutSupport> getSortShortcutSupport() {
new SortShortcutSupport(this::minimalMapping, this::writeField, false)
);
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,9 @@ public void testDisableIndex() throws IOException {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -803,4 +803,9 @@ protected IngestScriptSupport ingestScriptSupport() {
protected List<SortShortcutSupport> getSortShortcutSupport() {
return List.of();
}

@Override
protected boolean supportsDocValuesSkippers() {
return false;
}
}
Loading