Skip to content

Commit 6916dff

Browse files
authored
Register the _ts_routing_hash value format as named writeable (elastic#113452) (elastic#113463)
In elastic#113373 we added a yaml test that can exercise the path of parsing `_ts_routing_hash` values however, the doc value format was not already registered in the `NamedWriteableRegistry`. This makes the `TimeSeriesRoutingHashFieldType` doc value format `NamedWriteable` available in the `NamedWriteableRegistry` (cherry picked from commit d07d167) Signed-off-by: Andrei Dan <[email protected]>
1 parent 0631be5 commit 6916dff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

server/src/main/java/org/elasticsearch/index/mapper/TimeSeriesRoutingHashFieldMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ public class TimeSeriesRoutingHashFieldMapper extends MetadataFieldMapper {
4848
public static final TypeParser PARSER = new FixedTypeParser(c -> c.getIndexSettings().getMode().timeSeriesRoutingHashFieldMapper());
4949
static final NodeFeature TS_ROUTING_HASH_FIELD_PARSES_BYTES_REF = new NodeFeature("tsdb.ts_routing_hash_doc_value_parse_byte_ref");
5050

51+
public static DocValueFormat TS_ROUTING_HASH_DOC_VALUE_FORMAT = TimeSeriesRoutingHashFieldType.DOC_VALUE_FORMAT;
52+
5153
static final class TimeSeriesRoutingHashFieldType extends MappedFieldType {
5254

5355
private static final TimeSeriesRoutingHashFieldType INSTANCE = new TimeSeriesRoutingHashFieldType();
54-
private static final DocValueFormat DOC_VALUE_FORMAT = new DocValueFormat() {
56+
static final DocValueFormat DOC_VALUE_FORMAT = new DocValueFormat() {
5557

5658
@Override
5759
public String getWriteableName() {

server/src/main/java/org/elasticsearch/search/SearchModule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@
276276

277277
import static java.util.Collections.unmodifiableMap;
278278
import static java.util.Objects.requireNonNull;
279+
import static org.elasticsearch.index.mapper.TimeSeriesRoutingHashFieldMapper.TS_ROUTING_HASH_DOC_VALUE_FORMAT;
279280

280281
/**
281282
* Sets up things that can be done at search time like queries, aggregations, and suggesters.
@@ -1023,6 +1024,7 @@ private void registerValueFormats() {
10231024
registerValueFormat(DocValueFormat.BINARY.getWriteableName(), in -> DocValueFormat.BINARY);
10241025
registerValueFormat(DocValueFormat.UNSIGNED_LONG_SHIFTED.getWriteableName(), in -> DocValueFormat.UNSIGNED_LONG_SHIFTED);
10251026
registerValueFormat(DocValueFormat.TIME_SERIES_ID.getWriteableName(), in -> DocValueFormat.TIME_SERIES_ID);
1027+
registerValueFormat(TS_ROUTING_HASH_DOC_VALUE_FORMAT.getWriteableName(), in -> TS_ROUTING_HASH_DOC_VALUE_FORMAT);
10261028
}
10271029

10281030
/**

0 commit comments

Comments
 (0)