From 44a13902f71a2473f8943e34291fa6979fd7de0e Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 25 Jan 2024 14:50:45 +0100 Subject: [PATCH] added index.mapping.non_text_fields.shared.inverted_index setting. --- .../elasticsearch/common/settings/IndexScopedSettings.java | 1 + .../main/java/org/elasticsearch/index/IndexSettings.java | 7 +++++++ .../java/org/elasticsearch/index/mapper/MapperService.java | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java b/server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java index c1b8d51c255db..414c944ad24dc 100644 --- a/server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java +++ b/server/src/main/java/org/elasticsearch/common/settings/IndexScopedSettings.java @@ -155,6 +155,7 @@ public final class IndexScopedSettings extends AbstractScopedSettings { MapperService.INDEX_MAPPING_DEPTH_LIMIT_SETTING, MapperService.INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING, MapperService.INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING, + MapperService.INDEX_MAPPING_NON_TEXT_FIELDS_SHARED_INVERTED_INDEX, BitsetFilterCache.INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING, IndexModule.INDEX_STORE_TYPE_SETTING, IndexModule.INDEX_STORE_PRE_LOAD_SETTING, diff --git a/server/src/main/java/org/elasticsearch/index/IndexSettings.java b/server/src/main/java/org/elasticsearch/index/IndexSettings.java index 83a6d9319c75a..ba8ef597d9814 100644 --- a/server/src/main/java/org/elasticsearch/index/IndexSettings.java +++ b/server/src/main/java/org/elasticsearch/index/IndexSettings.java @@ -44,6 +44,7 @@ import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING; import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING; import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING; +import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_NON_TEXT_FIELDS_SHARED_INVERTED_INDEX; import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING; /** @@ -756,6 +757,7 @@ private void setRetentionLeaseMillis(final TimeValue retentionLease) { private volatile long mappingDepthLimit; private volatile long mappingFieldNameLengthLimit; private volatile long mappingDimensionFieldsLimit; + private final boolean mappingNonTextFieldsSharedInvertedIndex; /** * The maximum number of refresh listeners allows on this shard. @@ -900,6 +902,7 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti mappingDepthLimit = scopedSettings.get(INDEX_MAPPING_DEPTH_LIMIT_SETTING); mappingFieldNameLengthLimit = scopedSettings.get(INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING); mappingDimensionFieldsLimit = scopedSettings.get(INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING); + mappingNonTextFieldsSharedInvertedIndex = scopedSettings.get(INDEX_MAPPING_NON_TEXT_FIELDS_SHARED_INVERTED_INDEX); indexRouting = IndexRouting.fromIndexMetadata(indexMetadata); es87TSDBCodecEnabled = scopedSettings.get(TIME_SERIES_ES87TSDB_CODEC_ENABLED_SETTING); @@ -1543,6 +1546,10 @@ private void setMappingDimensionFieldsLimit(long value) { this.mappingDimensionFieldsLimit = value; } + public boolean isMappingNonTextFieldsSharedInvertedIndex() { + return mappingNonTextFieldsSharedInvertedIndex; + } + /** * The bounds for {@code @timestamp} on this index or * {@code null} if there are no bounds. diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java index b714eabbd2636..d1d7a12de3050 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -121,6 +121,11 @@ public enum MergeReason { Property.Dynamic, Property.IndexScope ); + public static final Setting INDEX_MAPPING_NON_TEXT_FIELDS_SHARED_INVERTED_INDEX = Setting.boolSetting( + "index.mapping.non_text_fields.shared.inverted_index", + false, + Property.IndexScope + ); private final IndexAnalyzers indexAnalyzers; private final MappingParser mappingParser;