Skip to content

Commit

Permalink
fix: gate sparse index usage with feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
salvatore-campagna committed Jan 24, 2025
1 parent db8374e commit 328e42b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.util.FeatureFlag;
import org.elasticsearch.common.util.Maps;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.IndexMode;
Expand Down Expand Up @@ -63,6 +64,7 @@
public abstract class FieldMapper extends Mapper {
private static final Logger logger = LogManager.getLogger(FieldMapper.class);

public static final FeatureFlag DOC_VALUES_SPARSE_INDEX = new FeatureFlag("doc_values_sparse_index");
public static final Setting<Boolean> IGNORE_MALFORMED_SETTING = Setting.boolSetting("index.mapping.ignore_malformed", settings -> {
if (IndexSettings.MODE.get(settings) == IndexMode.LOGSDB
&& IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(settings).onOrAfter(IndexVersions.ENABLE_IGNORE_MALFORMED_LOGSDB)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ private boolean shouldUseDocValuesSparseIndex(
final IndexMode indexMode,
final String fullFieldName
) {
if (FieldMapper.DOC_VALUES_SPARSE_INDEX.isEnabled() == false) {
return false;
}
boolean isIndexedAndDocValuesDefault = indexed.isConfigured() || hasDocValues.isConfigured();
boolean isNotIndexedAndHasDocValues = indexed.getValue() || hasDocValues.getValue() == false;
boolean isLogsDbMode = IndexMode.LOGSDB.equals(indexMode);
Expand Down

0 comments on commit 328e42b

Please sign in to comment.