public NumericMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Numeric>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Numeric>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public BytesMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Bytes>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Bytes>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public GeoPointValuesSource(Map<String, ValuesSourceConfig<ValuesSource.GeoPoint>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.GeoPoint>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } } }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { VS vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(vs, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override protected CompositeValuesSourceConfig innerBuild(SearchContext context, ValuesSourceConfig<?> config) throws IOException { ValuesSource orig = config.toValuesSource(context.getQueryShardContext()); if (orig == null) { orig = ValuesSource.Numeric.EMPTY; } if (orig instanceof ValuesSource.Numeric) { ValuesSource.Numeric numeric = (ValuesSource.Numeric) orig; final HistogramValuesSource vs = new HistogramValuesSource(numeric, interval); final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; return new CompositeValuesSourceConfig(name, fieldType, vs, config.format(), order(), missingBucket(), missing()); } else { throw new IllegalArgumentException("invalid source, expected numeric, got " + orig.getClass().getSimpleName()); } } }
@Override protected CompositeValuesSourceConfig innerBuild(SearchContext context, ValuesSourceConfig<?> config) throws IOException { Rounding rounding = createRounding(); ValuesSource orig = config.toValuesSource(context.getQueryShardContext()); if (orig == null) { orig = ValuesSource.Numeric.EMPTY; } if (orig instanceof ValuesSource.Numeric) { ValuesSource.Numeric numeric = (ValuesSource.Numeric) orig; RoundingValuesSource vs = new RoundingValuesSource(numeric, rounding); // is specified in the builder. final DocValueFormat docValueFormat = format() == null ? DocValueFormat.RAW : config.format(); final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; return new CompositeValuesSourceConfig(name, fieldType, vs, docValueFormat, order(), missingBucket(), missing()); } else { throw new IllegalArgumentException("invalid source, expected numeric, got " + orig.getClass().getSimpleName()); } } }
@Override protected CompositeValuesSourceConfig innerBuild(SearchContext context, ValuesSourceConfig<?> config) throws IOException { ValuesSource vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { vs = ValuesSource.Numeric.EMPTY; } final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; final DocValueFormat format; if (format() == null && fieldType instanceof DateFieldMapper.DateFieldType) { // defaults to the raw format on date fields (preserve timestamp as longs). format = DocValueFormat.RAW; } else { format = config.format(); } return new CompositeValuesSourceConfig(name, fieldType, vs, format, order(), missingBucket(), missing()); } }
public BytesMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Bytes>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Bytes>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public NumericMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Numeric>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Numeric>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public GeoPointValuesSource(Map<String, ValuesSourceConfig<ValuesSource.GeoPoint>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.GeoPoint>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } } }
public NumericMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Numeric>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Numeric>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public BytesMultiValuesSource(Map<String, ValuesSourceConfig<ValuesSource.Bytes>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.Bytes>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } }
public GeoPointValuesSource(Map<String, ValuesSourceConfig<ValuesSource.GeoPoint>> valuesSourceConfigs, QueryShardContext context) throws IOException { values = new HashMap<>(valuesSourceConfigs.size()); for (Map.Entry<String, ValuesSourceConfig<ValuesSource.GeoPoint>> entry : valuesSourceConfigs.entrySet()) { values.put(entry.getKey(), entry.getValue().toValuesSource(context)); } } }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { HashMap<String, VS> valuesSources = new HashMap<>(); for (Map.Entry<String, ValuesSourceConfig<VS>> config : configs.entrySet()) { VS vs = config.getValue().toValuesSource(context.getQueryShardContext()); if (vs != null) { valuesSources.put(config.getKey(), vs); } } if (valuesSources.isEmpty()) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(valuesSources, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { HashMap<String, VS> valuesSources = new HashMap<>(); for (Map.Entry<String, ValuesSourceConfig<VS>> config : configs.entrySet()) { VS vs = config.getValue().toValuesSource(context.getQueryShardContext()); if (vs != null) { valuesSources.put(config.getKey(), vs); } } if (valuesSources.isEmpty()) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(valuesSources, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { VS vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(vs, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { VS vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(vs, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override public Aggregator createInternal(Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { VS vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { return createUnmapped(parent, pipelineAggregators, metaData); } return doCreateInternal(vs, parent, collectsFromSingleBucket, pipelineAggregators, metaData); }
@Override protected CompositeValuesSourceConfig innerBuild(SearchContext context, ValuesSourceConfig<?> config) throws IOException { ValuesSource orig = config.toValuesSource(context.getQueryShardContext()); if (orig == null) { orig = ValuesSource.Numeric.EMPTY; } if (orig instanceof ValuesSource.Numeric) { ValuesSource.Numeric numeric = (ValuesSource.Numeric) orig; final HistogramValuesSource vs = new HistogramValuesSource(numeric, interval); final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; return new CompositeValuesSourceConfig(name, fieldType, vs, config.format(), order(), missingBucket(), missing()); } else { throw new IllegalArgumentException("invalid source, expected numeric, got " + orig.getClass().getSimpleName()); } } }
@Override protected CompositeValuesSourceConfig innerBuild(SearchContext context, ValuesSourceConfig<?> config) throws IOException { ValuesSource vs = config.toValuesSource(context.getQueryShardContext()); if (vs == null) { vs = ValuesSource.Numeric.EMPTY; } final MappedFieldType fieldType = config.fieldContext() != null ? config.fieldContext().fieldType() : null; final DocValueFormat format; if (format() == null && fieldType instanceof DateFieldMapper.DateFieldType) { // defaults to the raw format on date fields (preserve timestamp as longs). format = DocValueFormat.RAW; } else { format = config.format(); } return new CompositeValuesSourceConfig(name, fieldType, vs, format, order(), missingBucket(), missing()); } }