Skip to content
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add FIPS build tooling ([#4254](https://github.com/opensearch-project/security/issues/4254))
- Support Nested Aggregations as part of Star-Tree ([#18048](https://github.com/opensearch-project/OpenSearch/pull/18048))
- [Star-Tree] Support for date-range queries with star-tree supported aggregations ([#17855](https://github.com/opensearch-project/OpenSearch/pull/17855)
- [Star tree] Remove star tree feature flag and add index setting to configure star tree search on index basis ([#18070](https://github.com/opensearch-project/OpenSearch/pull/18070))
- Approximation Framework Enhancement: Update the BKD traversal logic to improve the performance on skewed data ([#18439](https://github.com/opensearch-project/OpenSearch/issues/18439))

### Changed
Expand Down
4 changes: 0 additions & 4 deletions distribution/src/config/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,3 @@ ${path.logs}
# Once there is no observed impact on performance, this feature flag can be removed.
#
#opensearch.experimental.optimization.datetime_formatter_caching.enabled: false
#
# Gates the functionality of star tree index, which improves the performance of search aggregations.
#
#opensearch.experimental.feature.composite_index.star_tree.enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import java.util.List;

import static java.util.Collections.singletonList;
import static org.opensearch.common.util.FeatureFlags.STAR_TREE_INDEX;
import static org.hamcrest.Matchers.containsString;

public class ScaledFloatFieldMapperTests extends MapperTestCase {
Expand Down Expand Up @@ -104,7 +103,6 @@ public void testExistsQueryDocValuesDisabled() throws IOException {
assertParseMinimalWarnings();
}

@LockFeatureFlag(STAR_TREE_INDEX)
public void testScaledFloatWithStarTree() throws Exception {

double scalingFactorField1 = randomDouble() * 100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.Rounding;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.core.index.Index;
Expand Down Expand Up @@ -581,11 +580,6 @@ private static String getMetric(boolean hasDocValues, boolean isKeyword) {
return "numeric_dv";
}

@Override
protected Settings featureFlagSettings() {
return Settings.builder().put(super.featureFlagSettings()).put(FeatureFlags.STAR_TREE_INDEX, "true").build();
}

@Before
public final void setupNodeSettings() {
Settings request = Settings.builder().put(CompositeIndexSettings.STAR_TREE_INDEX_ENABLED_SETTING.getKey(), true).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ protected FeatureFlagSettings(
FeatureFlags.DATETIME_FORMATTER_CACHING_SETTING,
FeatureFlags.WRITABLE_WARM_INDEX_SETTING,
FeatureFlags.REMOTE_STORE_MIGRATION_EXPERIMENTAL_SETTING,
FeatureFlags.STAR_TREE_INDEX_SETTING,
FeatureFlags.APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING,
FeatureFlags.TERM_VERSION_PRECOMMIT_ENABLE_SETTING,
FeatureFlags.ARROW_STREAMS_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
StarTreeIndexSettings.STAR_TREE_MAX_DATE_INTERVALS_SETTING,
StarTreeIndexSettings.STAR_TREE_MAX_BASE_METRICS_SETTING,
StarTreeIndexSettings.IS_COMPOSITE_INDEX_SETTING,
StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING,

IndexSettings.INDEX_CONTEXT_CREATED_VERSION,
IndexSettings.INDEX_CONTEXT_CURRENT_VERSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ public class FeatureFlags {
Property.NodeScope
);

/**
* Gates the functionality of star tree index, which improves the performance of search
* aggregations.
*/
public static final String STAR_TREE_INDEX = FEATURE_FLAG_PREFIX + "composite_index.star_tree.enabled";
public static final Setting<Boolean> STAR_TREE_INDEX_SETTING = Setting.boolSetting(STAR_TREE_INDEX, false, Property.NodeScope);

/**
* Gates the functionality of application based configuration templates.
*/
Expand Down Expand Up @@ -154,7 +147,6 @@ static class FeatureFlagsImpl {
put(TELEMETRY_SETTING, TELEMETRY_SETTING.getDefault(Settings.EMPTY));
put(DATETIME_FORMATTER_CACHING_SETTING, DATETIME_FORMATTER_CACHING_SETTING.getDefault(Settings.EMPTY));
put(WRITABLE_WARM_INDEX_SETTING, WRITABLE_WARM_INDEX_SETTING.getDefault(Settings.EMPTY));
put(STAR_TREE_INDEX_SETTING, STAR_TREE_INDEX_SETTING.getDefault(Settings.EMPTY));
put(
APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING,
APPLICATION_BASED_CONFIGURATION_TEMPLATES_SETTING.getDefault(Settings.EMPTY)
Expand Down
18 changes: 18 additions & 0 deletions server/src/main/java/org/opensearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,16 @@
*/
private volatile double docIdFuzzySetFalsePositiveProbability;

/**
* Denotes whether this is a composite index i.e star-tree index etc
*/
private final boolean isCompositeIndex;

/**
* Denotes whether search via star tree index is enabled for this index
*/
private volatile boolean isStarTreeIndexEnabled;

/**
* Returns the default search fields for this index.
*/
Expand Down Expand Up @@ -1096,6 +1104,7 @@
setEnableFuzzySetForDocId(scopedSettings.get(INDEX_DOC_ID_FUZZY_SET_ENABLED_SETTING));
setDocIdFuzzySetFalsePositiveProbability(scopedSettings.get(INDEX_DOC_ID_FUZZY_SET_FALSE_POSITIVE_PROBABILITY_SETTING));
isCompositeIndex = scopedSettings.get(StarTreeIndexSettings.IS_COMPOSITE_INDEX_SETTING);
isStarTreeIndexEnabled = scopedSettings.get(StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING);
scopedSettings.addSettingsUpdateConsumer(
TieredMergePolicyProvider.INDEX_COMPOUND_FORMAT_SETTING,
tieredMergePolicyProvider::setNoCFSRatio
Expand Down Expand Up @@ -1220,6 +1229,7 @@
IndexMetadata.INDEX_REMOTE_TRANSLOG_REPOSITORY_SETTING,
this::setRemoteStoreTranslogRepository
);
scopedSettings.addSettingsUpdateConsumer(StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING, this::setStarTreeIndexEnabled);
}

private void setSearchIdleAfter(TimeValue searchIdleAfter) {
Expand Down Expand Up @@ -1790,6 +1800,14 @@
return gcDeletesInMillis;
}

public void setStarTreeIndexEnabled(boolean value) {
this.isStarTreeIndexEnabled = value;
}

Check warning on line 1805 in server/src/main/java/org/opensearch/index/IndexSettings.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/IndexSettings.java#L1804-L1805

Added lines #L1804 - L1805 were not covered by tests

public boolean getStarTreeIndexEnabled() {
return isStarTreeIndexEnabled;

Check warning on line 1808 in server/src/main/java/org/opensearch/index/IndexSettings.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/index/IndexSettings.java#L1808

Added line #L1808 was not covered by tests
}

/**
* Returns the merge policy that should be used for this index.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;

Expand All @@ -25,16 +24,7 @@
public class CompositeIndexSettings {
public static final Setting<Boolean> STAR_TREE_INDEX_ENABLED_SETTING = Setting.boolSetting(
"indices.composite_index.star_tree.enabled",
false,
value -> {
if (FeatureFlags.isEnabled(FeatureFlags.STAR_TREE_INDEX_SETTING) == false && value == true) {
throw new IllegalArgumentException(
"star tree index is under an experimental feature and can be activated only by enabling "
+ FeatureFlags.STAR_TREE_INDEX_SETTING.getKey()
+ " feature flag in the JVM options"
);
}
},
true,
Setting.Property.NodeScope,
Setting.Property.Dynamic
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,11 @@ public static DateTimeUnitRounding getTimeUnit(String expression) {
Setting.Property.IndexScope,
Setting.Property.Final
);

public static final Setting<Boolean> STAR_TREE_SEARCH_ENABLED_SETTING = Setting.boolSetting(
"index.search.star_tree_index.enabled",
true,
Setting.Property.IndexScope,
Setting.Property.Dynamic
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,18 @@ public static void validate(MapperService mapperService, CompositeIndexSettings
if (!(compositeFieldType != null && compositeFieldType.unwrap() instanceof StarTreeMapper.StarTreeFieldType)) {
continue;
}
if (!compositeIndexSettings.isStarTreeIndexCreationEnabled()) {

if (indexSettings.getSettings()
.getAsBoolean(
StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING.getKey(),
compositeIndexSettings.isStarTreeIndexCreationEnabled()
) == false) {
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"star tree index cannot be created, enable it using [%s] setting",
CompositeIndexSettings.STAR_TREE_INDEX_ENABLED_SETTING.getKey()
"star tree index cannot be created, enable it using [%s] cluster setting or [%s] index setting",
CompositeIndexSettings.STAR_TREE_INDEX_ENABLED_SETTING.getKey(),
StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING.getKey()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.opensearch.common.collect.CopyOnWriteHashMap;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.common.xcontent.support.XContentMapValues;
import org.opensearch.core.xcontent.ToXContent;
import org.opensearch.core.xcontent.XContentBuilder;
Expand Down Expand Up @@ -447,13 +446,6 @@ protected static void parseCompositeField(
Map<String, Object> compositeNode,
ParserContext parserContext
) {
if (!FeatureFlags.isEnabled(FeatureFlags.STAR_TREE_INDEX_SETTING)) {
throw new IllegalArgumentException(
"star tree index is under an experimental feature and can be activated only by enabling "
+ FeatureFlags.STAR_TREE_INDEX_SETTING.getKey()
+ " feature flag in the JVM options"
);
}
if (StarTreeIndexSettings.IS_COMPOSITE_INDEX_SETTING.get(parserContext.getSettings()) == false) {
throw new IllegalArgumentException(
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
import org.opensearch.index.IndexService;
import org.opensearch.index.IndexSettings;
import org.opensearch.index.cache.bitset.BitsetFilterCache;
import org.opensearch.index.compositeindex.CompositeIndexSettings;
import org.opensearch.index.compositeindex.datacube.startree.StarTreeIndexSettings;
import org.opensearch.index.engine.Engine;
import org.opensearch.index.mapper.MappedFieldType;
import org.opensearch.index.mapper.MapperService;
Expand Down Expand Up @@ -1148,6 +1150,16 @@ public boolean shouldUseTimeSeriesDescSortOptimization() {
&& sort.sort.getSort()[0].getReverse() == false;
}

@Override
public boolean getStarTreeIndexEnabled() {
return indexService.getIndexSettings()
.getSettings()
.getAsBoolean(
StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING.getKey(),
clusterService.getClusterSettings().get(CompositeIndexSettings.STAR_TREE_INDEX_ENABLED_SETTING)
);
}

@Override
public int maxAggRewriteFilters() {
return maxAggRewriteFilters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1557,9 +1557,7 @@ private void parseSource(DefaultSearchContext context, SearchSourceBuilder sourc
context.setProfilers(new Profilers(context.searcher(), context.shouldUseConcurrentSearch()));
}

if (this.indicesService.getCompositeIndexSettings() != null
&& this.indicesService.getCompositeIndexSettings().isStarTreeIndexCreationEnabled()
&& StarTreeQueryHelper.isStarTreeSupported(context)) {
if (context.getStarTreeIndexEnabled() && StarTreeQueryHelper.isStarTreeSupported(context)) {
StarTreeQueryContext starTreeQueryContext = new StarTreeQueryContext(context, source.query());
boolean consolidated = starTreeQueryContext.consolidateAllFilters(context);
if (consolidated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,4 +582,9 @@
public boolean shouldUseTimeSeriesDescSortOptimization() {
return in.shouldUseTimeSeriesDescSortOptimization();
}

@Override
public boolean getStarTreeIndexEnabled() {
return in.getStarTreeIndexEnabled();

Check warning on line 588 in server/src/main/java/org/opensearch/search/internal/FilteredSearchContext.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/search/internal/FilteredSearchContext.java#L588

Added line #L588 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ public String toString() {

public abstract boolean shouldUseTimeSeriesDescSortOptimization();

public abstract boolean getStarTreeIndexEnabled();

public int maxAggRewriteFilters() {
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.apache.lucene.util.FixedBitSet;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.index.codec.composite.CompositeIndexFieldInfo;
import org.opensearch.index.compositeindex.datacube.DateDimension;
import org.opensearch.index.compositeindex.datacube.Dimension;
Expand Down Expand Up @@ -251,21 +250,20 @@ private static boolean validateNestedAggregationStructure(
AggregatorFactory aggregatorFactory
) {
boolean isValid;
boolean isFeatureFlagEnabled = FeatureFlags.isEnabled(FeatureFlags.STAR_TREE_INDEX_SETTING);

switch (aggregatorFactory) {
case TermsAggregatorFactory termsAggregatorFactory -> isValid = validateKeywordTermsAggregationSupport(
compositeIndexFieldInfo,
termsAggregatorFactory
) && isFeatureFlagEnabled;
);
case DateHistogramAggregatorFactory dateHistogramAggregatorFactory -> isValid = validateDateHistogramSupport(
compositeIndexFieldInfo,
dateHistogramAggregatorFactory
);
case RangeAggregatorFactory rangeAggregatorFactory -> isValid = validateRangeAggregationSupport(
compositeIndexFieldInfo,
rangeAggregatorFactory
) && isFeatureFlagEnabled;
);
case MetricAggregatorFactory metricAggregatorFactory -> {
isValid = validateStarTreeMetricSupport(compositeIndexFieldInfo, metricAggregatorFactory);
return isValid && metricAggregatorFactory.getSubFactories().getFactories().length == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.CheckedConsumer;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
Expand All @@ -35,23 +34,18 @@
import org.opensearch.index.mapper.MapperService;
import org.opensearch.indices.IndicesModule;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import static org.opensearch.common.util.FeatureFlags.STAR_TREE_INDEX;

/**
* Abstract star tree doc values Lucene tests
*/
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
public abstract class AbstractStarTreeDVFormatTests extends BaseDocValuesFormatTestCase {
private static FeatureFlags.TestUtils.FlagWriteLock ffLock = null;
MapperService mapperService = null;
StarTreeFieldConfiguration.StarTreeBuildMode buildMode;

Expand All @@ -67,16 +61,6 @@ public static Collection<Object[]> parameters() {
return parameters;
}

@BeforeClass
public static void createMapper() {
ffLock = new FeatureFlags.TestUtils.FlagWriteLock(STAR_TREE_INDEX);
}

@AfterClass
public static void clearMapper() {
ffLock.close();
}

@After
public void teardown() throws IOException {
mapperService.close();
Expand Down
Loading
Loading