Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix pull-based ingestion out-of-bounds offset scenarios and remove persisted offsets ([#19607](https://github.com/opensearch-project/OpenSearch/pull/19607))
- [Star Tree] Fix sub-aggregator casting for search with profile=true ([19652](https://github.com/opensearch-project/OpenSearch/pull/19652))
- Fix issue with updating core with a patch number other than 0 ([#19377](https://github.com/opensearch-project/OpenSearch/pull/19377))
- Fix bwc @timestamp upgrade issue by adding a version check on skip_list param ([19670](https://github.com/opensearch-project/OpenSearch/pull/19670))

### Dependencies
- Update to Gradle 9.1 ([#19575](https://github.com/opensearch-project/OpenSearch/pull/19575))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,14 +852,15 @@ protected void parseCreateField(ParseContext context) throws IOException {
}

boolean isSkiplistDefaultEnabled(IndexSortConfig indexSortConfig, String fieldName) {
if (!isSkiplistConfigured) {
if (indexSortConfig.hasPrimarySortOnField(fieldName)) {
return true;
}
if (DataStreamFieldMapper.Defaults.TIMESTAMP_FIELD.getName().equals(fieldName)) {
return true;
if (this.indexCreatedVersion.onOrAfter(Version.V_3_3_0)) {
if (!isSkiplistConfigured) {
if (indexSortConfig.hasPrimarySortOnField(fieldName)) {
return true;
}
if (DataStreamFieldMapper.Defaults.TIMESTAMP_FIELD.getName().equals(fieldName)) {
return true;
}
}

}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,16 +869,25 @@ public void testSkipListIntegrationMappingDefinitionSerialization() throws IOExc

public void testIsSkiplistDefaultEnabled() throws IOException {
DocumentMapper mapper = createDocumentMapper(fieldMapping(b -> b.field("type", "date")));
testIsSkiplistEnabled(mapper, true);

}

public void testIsSkiplistDefaultDisabledInOlderVersions() throws IOException {
DocumentMapper mapper = createDocumentMapper(Version.V_3_2_0, fieldMapping(b -> b.field("type", "date")));
testIsSkiplistEnabled(mapper, false);
}

private void testIsSkiplistEnabled(DocumentMapper mapper, boolean expectedValue) throws IOException {
DateFieldMapper dateFieldMapper = (DateFieldMapper) mapper.mappers().getMapper("field");

// Test with no index sort and non-timestamp field
IndexMetadata noSortindexMetadata = new IndexMetadata.Builder("index").settings(getIndexSettings()).build();
IndexSettings noSolrIndexSettings = new IndexSettings(noSortindexMetadata, getIndexSettings());
IndexSortConfig noSortConfig = new IndexSortConfig(new IndexSettings(noSortindexMetadata, getIndexSettings()));
assertFalse(dateFieldMapper.isSkiplistDefaultEnabled(noSortConfig, "field"));

// timestamp field
assertTrue(dateFieldMapper.isSkiplistDefaultEnabled(noSortConfig, "@timestamp"));
assertEquals(expectedValue, dateFieldMapper.isSkiplistDefaultEnabled(noSortConfig, "@timestamp"));

// Create index settings with an index sort.
Settings settings = Settings.builder()
Expand All @@ -892,10 +901,12 @@ public void testIsSkiplistDefaultEnabled() throws IOException {
IndexMetadata indexMetadata = new IndexMetadata.Builder("index").settings(settings).build();
IndexSettings indexSettings = new IndexSettings(indexMetadata, settings);
IndexSortConfig sortConfig = new IndexSortConfig(indexSettings);
assertTrue(dateFieldMapper.isSkiplistDefaultEnabled(sortConfig, "field"));
assertTrue(dateFieldMapper.isSkiplistDefaultEnabled(sortConfig, "@timestamp"));
assertEquals(expectedValue, dateFieldMapper.isSkiplistDefaultEnabled(sortConfig, "field"));
assertEquals(expectedValue, dateFieldMapper.isSkiplistDefaultEnabled(sortConfig, "@timestamp"));
}



public void testSkipListIntegrationFieldBehaviorConsistency() throws IOException {
// Test that field behavior is consistent between skip_list enabled and disabled

Expand Down
Loading