Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix flaky test FieldDataLoadingIT.testIndicesFieldDataCacheSizeSetting ([#19571](https://github.com/opensearch-project/OpenSearch/pull/19571))
- Avoid primary shard failure caused by merged segment warmer exceptions ([#19436](https://github.com/opensearch-project/OpenSearch/pull/19436))
- 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))

### Dependencies
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,8 +901,8 @@ 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 {
Expand Down
Loading