Skip to content

Commit

Permalink
Register the _ts_routing_hash value format as named writeable (elasti…
Browse files Browse the repository at this point in the history
…c#113452)

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]>
  • Loading branch information
andreidan committed Sep 24, 2024
1 parent f8dbda3 commit c966143
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public class TimeSeriesRoutingHashFieldMapper extends MetadataFieldMapper {
public static final TypeParser PARSER = new FixedTypeParser(c -> c.getIndexSettings().getMode().timeSeriesRoutingHashFieldMapper());
static final NodeFeature TS_ROUTING_HASH_FIELD_PARSES_BYTES_REF = new NodeFeature("tsdb.ts_routing_hash_doc_value_parse_byte_ref");

public static DocValueFormat TS_ROUTING_HASH_DOC_VALUE_FORMAT = TimeSeriesRoutingHashFieldType.DOC_VALUE_FORMAT;

static final class TimeSeriesRoutingHashFieldType extends MappedFieldType {

private static final TimeSeriesRoutingHashFieldType INSTANCE = new TimeSeriesRoutingHashFieldType();
private static final DocValueFormat DOC_VALUE_FORMAT = new DocValueFormat() {
static final DocValueFormat DOC_VALUE_FORMAT = new DocValueFormat() {

@Override
public String getWriteableName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@

import static java.util.Collections.unmodifiableMap;
import static java.util.Objects.requireNonNull;
import static org.elasticsearch.index.mapper.TimeSeriesRoutingHashFieldMapper.TS_ROUTING_HASH_DOC_VALUE_FORMAT;

/**
* Sets up things that can be done at search time like queries, aggregations, and suggesters.
Expand Down Expand Up @@ -1023,6 +1024,7 @@ private void registerValueFormats() {
registerValueFormat(DocValueFormat.BINARY.getWriteableName(), in -> DocValueFormat.BINARY);
registerValueFormat(DocValueFormat.UNSIGNED_LONG_SHIFTED.getWriteableName(), in -> DocValueFormat.UNSIGNED_LONG_SHIFTED);
registerValueFormat(DocValueFormat.TIME_SERIES_ID.getWriteableName(), in -> DocValueFormat.TIME_SERIES_ID);
registerValueFormat(TS_ROUTING_HASH_DOC_VALUE_FORMAT.getWriteableName(), in -> TS_ROUTING_HASH_DOC_VALUE_FORMAT);
}

/**
Expand Down

0 comments on commit c966143

Please sign in to comment.