Skip to content

Commit 602c203

Browse files
committed
Disable compression for geo_shape type
1 parent 80c14a3 commit 602c203

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

server/src/main/java/org/elasticsearch/index/codec/PerFieldFormatSupplier.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
public class PerFieldFormatSupplier {
4242

4343
private static final Set<String> INCLUDE_META_FIELDS;
44+
private static final Set<String> EXCLUDE_MAPPER_TYPES;
4445

4546
static {
4647
// TODO: should we just allow all fields to use tsdb doc values codec?
@@ -53,6 +54,7 @@ public class PerFieldFormatSupplier {
5354
// Don't the include _recovery_source_size and _recovery_source fields, since their values can be trimmed away in
5455
// RecoverySourcePruneMergePolicy, which leads to inconsistencies between merge stats and actual values.
5556
INCLUDE_META_FIELDS = Collections.unmodifiableSet(includeMetaField);
57+
EXCLUDE_MAPPER_TYPES = Set.of("geo_shape");
5658
}
5759

5860
private static final DocValuesFormat docValuesFormat = new Lucene90DocValuesFormat();
@@ -138,6 +140,10 @@ boolean useTSDBDocValuesFormat(final String field) {
138140
return false;
139141
}
140142

143+
if (excludeMapperTypes(field)) {
144+
return false;
145+
}
146+
141147
return mapperService != null
142148
&& (isTimeSeriesModeIndex() || isLogsModeIndex())
143149
&& mapperService.getIndexSettings().isES87TSDBCodecEnabled();
@@ -147,6 +153,14 @@ private boolean excludeFields(String fieldName) {
147153
return fieldName.startsWith("_") && INCLUDE_META_FIELDS.contains(fieldName) == false;
148154
}
149155

156+
private boolean excludeMapperTypes(String fieldName) {
157+
var typeName = getMapperType(fieldName);
158+
if (typeName == null) {
159+
return false;
160+
}
161+
return EXCLUDE_MAPPER_TYPES.contains(getMapperType(fieldName));
162+
}
163+
150164
private boolean isTimeSeriesModeIndex() {
151165
return mapperService != null && IndexMode.TIME_SERIES == mapperService.getIndexSettings().getMode();
152166
}
@@ -155,4 +169,13 @@ private boolean isLogsModeIndex() {
155169
return mapperService != null && IndexMode.LOGSDB == mapperService.getIndexSettings().getMode();
156170
}
157171

172+
String getMapperType(final String field) {
173+
if (mapperService != null) {
174+
Mapper mapper = mapperService.mappingLookup().getMapper(field);
175+
if (mapper != null) {
176+
return mapper.typeName();
177+
}
178+
}
179+
return null;
180+
}
158181
}

0 commit comments

Comments
 (0)