From a622cda5385890733b2a635185f81187c5ca95d3 Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Wed, 27 Aug 2025 10:38:26 +0200 Subject: [PATCH 1/2] Decrease size of _tsids created by TsidBuilder Based on testing, this has marginal impact on storage but decreases the size of the _tsids from 21B-36B to 18B-21B. --- .../cluster/routing/TsidBuilder.java | 24 +++++++----- .../cluster/routing/TsidBuilderTests.java | 37 +++++++++++++------ 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java b/server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java index d29dced2adb28..8ca2f095d0d72 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java @@ -31,7 +31,12 @@ */ public class TsidBuilder { - private static final int MAX_TSID_VALUE_FIELDS = 16; + /** + * The maximum number of fields to use for the value similarity part of the TSID. + * This is a trade-off between clustering similar time series together and the size of the TSID. + * More fields improve clustering but also increase the size of the TSID. + */ + private static final int MAX_TSID_VALUE_SIMILARITY_FIELDS = 4; private final BufferedMurmur3Hasher murmur3Hasher = new BufferedMurmur3Hasher(0L); private final List dimensions = new ArrayList<>(); @@ -209,11 +214,11 @@ public MurmurHash3.Hash128 hash() { * The TSID is a hash that includes: *