|
20 | 20 | import org.elasticsearch.index.IndexVersions; |
21 | 21 | import org.elasticsearch.index.codec.bloomfilter.ES87BloomFilterPostingsFormat; |
22 | 22 | import org.elasticsearch.index.codec.postings.ES812PostingsFormat; |
| 23 | +import org.elasticsearch.index.codec.tsdb.BinaryDVCompressionMode; |
23 | 24 | import org.elasticsearch.index.codec.tsdb.es819.ES819TSDBDocValuesFormat; |
24 | 25 | import org.elasticsearch.index.mapper.CompletionFieldMapper; |
25 | 26 | import org.elasticsearch.index.mapper.IdFieldMapper; |
| 27 | +import org.elasticsearch.index.mapper.KeywordFieldMapper; |
26 | 28 | import org.elasticsearch.index.mapper.Mapper; |
27 | 29 | import org.elasticsearch.index.mapper.MapperService; |
28 | 30 | import org.elasticsearch.index.mapper.SeqNoFieldMapper; |
@@ -57,7 +59,8 @@ public class PerFieldFormatSupplier { |
57 | 59 |
|
58 | 60 | private static final DocValuesFormat docValuesFormat = new Lucene90DocValuesFormat(); |
59 | 61 | private static final KnnVectorsFormat knnVectorsFormat = new Lucene99HnswVectorsFormat(); |
60 | | - private static final ES819TSDBDocValuesFormat tsdbDocValuesFormat = new ES819TSDBDocValuesFormat(); |
| 62 | + private static final ES819TSDBDocValuesFormat tsdbDocValuesFormat = new ES819TSDBDocValuesFormat(BinaryDVCompressionMode.NO_COMPRESS); |
| 63 | + private static final DocValuesFormat compressedBinaryDocValuesFormat = new ES819TSDBDocValuesFormat(BinaryDVCompressionMode.COMPRESSED_WITH_LZ4); |
61 | 64 | private static final ES812PostingsFormat es812PostingsFormat = new ES812PostingsFormat(); |
62 | 65 | private static final PostingsFormat completionPostingsFormat = PostingsFormat.forName("Completion101"); |
63 | 66 |
|
@@ -127,6 +130,13 @@ public KnnVectorsFormat getKnnVectorsFormatForField(String field) { |
127 | 130 | } |
128 | 131 |
|
129 | 132 | public DocValuesFormat getDocValuesFormatForField(String field) { |
| 133 | + if (mapperService != null) { |
| 134 | + Mapper mapper = mapperService.mappingLookup().getMapper(field); |
| 135 | + if (mapper != null && KeywordFieldMapper.CONTENT_TYPE.equals(mapper.typeName())) { |
| 136 | + return compressedBinaryDocValuesFormat; |
| 137 | + } |
| 138 | + } |
| 139 | + |
130 | 140 | if (useTSDBDocValuesFormat(field)) { |
131 | 141 | return tsdbDocValuesFormat; |
132 | 142 | } |
|
0 commit comments