Skip to content

Commit

Permalink
Better encapsulation
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidan committed Sep 24, 2024
1 parent 84000df commit 6018323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,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 final class TimeSeriesRoutingHashFieldType extends MappedFieldType {
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();
public 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 @@ -21,8 +21,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.index.mapper.TimeSeriesRoutingHashFieldMapper;
import org.elasticsearch.index.mapper.TimeSeriesRoutingHashFieldMapper.TimeSeriesRoutingHashFieldType;
import org.elasticsearch.index.query.AbstractQueryBuilder;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.BoostingQueryBuilder;
Expand Down Expand Up @@ -278,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 @@ -1025,10 +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(
TimeSeriesRoutingHashFieldType.DOC_VALUE_FORMAT.getWriteableName(),
in -> TimeSeriesRoutingHashFieldType.DOC_VALUE_FORMAT
);
registerValueFormat(TS_ROUTING_HASH_DOC_VALUE_FORMAT.getWriteableName(), in -> TS_ROUTING_HASH_DOC_VALUE_FORMAT);
}

/**
Expand Down

0 comments on commit 6018323

Please sign in to comment.