private ValuesSource.GeoPoint geoPointField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); } }
@Override protected Aggregator doCreateInternal(ValuesSource valuesSource, Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { if (valuesSource instanceof ValuesSource.Numeric) { return new DiversifiedNumericSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, metaData, (Numeric) valuesSource, maxDocsPerValue); } if (valuesSource instanceof ValuesSource.Bytes) { ExecutionMode execution = null; if (executionHint != null) { execution = ExecutionMode.fromString(executionHint); } // In some cases using ordinals is just not supported: override // it if (execution == null) { execution = ExecutionMode.GLOBAL_ORDINALS; } if ((execution.needsGlobalOrdinals()) && (!(valuesSource instanceof ValuesSource.Bytes.WithOrdinals))) { execution = ExecutionMode.MAP; } return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, context, parent, pipelineAggregators, metaData); } throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field() + "]. It can only be applied to numeric or string fields."); }
private ValuesSource.Numeric numericField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); if (script() != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); } return dataSource; }
MinAggregator(String name, ValuesSourceConfig<ValuesSource.Numeric> config, ValuesSource.Numeric valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { super(name, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; if (valuesSource != null) { mins = context.bigArrays().newDoubleArray(1, false); mins.fill(0, mins.size(), Double.POSITIVE_INFINITY); } this.format = config.format(); this.pointConverter = getPointReaderOrNull(context, parent, config); if (pointConverter != null) { pointField = config.fieldContext().field(); } else { pointField = null; } }
private ValuesSource.GeoPoint geoPointField(ValuesSourceConfig<?> config) throws IOException { if (!(config.fieldContext.indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + config.fieldContext.field() + "], but got [" + config.fieldContext.fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) config.fieldContext.indexFieldData()); }
MaxAggregator(String name, ValuesSourceConfig<ValuesSource.Numeric> config, ValuesSource.Numeric valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { super(name, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; if (valuesSource != null) { maxes = context.bigArrays().newDoubleArray(1, false); maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY); } this.formatter = config.format(); this.pointConverter = getPointReaderOrNull(context, parent, config); if (pointConverter != null) { pointField = config.fieldContext().field(); } else { pointField = null; } }
private ValuesSource.Numeric numericField(ValuesSourceConfig<?> config) throws IOException { if (!(config.fieldContext.indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + config.fieldContext.field() + "], but got [" + config.fieldContext.fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData) config.fieldContext.indexFieldData()); if (config.script != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, config.script); } return dataSource; }
+ config.fieldContext().field() + "]. It can only be applied to numeric or string fields.");
private ValuesSource.GeoPoint geoPointField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); } }
private void setFieldInfo(SearchContext context) { if (!config.unmapped()) { this.indexedFieldName = config.fieldContext().field(); fieldType = context.smartNameFieldType(indexedFieldName); } }
private ValuesSource.GeoPoint geoPointField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); } }
throw new AggregationExecutionException("terms aggregation cannot be applied to field [" + config.fieldContext().field() + "]. It can only be applied to numeric or string fields.");
private ValuesSource.GeoPoint geoPointField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexGeoPointFieldData)) { throw new IllegalArgumentException("Expected geo_point type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } return new ValuesSource.GeoPoint.Fielddata((IndexGeoPointFieldData) fieldContext().indexFieldData()); } }
public SignificantTermsAggregatorFactory(String name, ValuesSourceConfig valueSourceConfig, TermsAggregator.BucketCountThresholds bucketCountThresholds, IncludeExclude includeExclude, String executionHint, Query filter, SignificanceHeuristic significanceHeuristic) { super(name, SignificantStringTerms.TYPE.name(), valueSourceConfig); this.bucketCountThresholds = bucketCountThresholds; this.includeExclude = includeExclude; this.executionHint = executionHint; this.significanceHeuristic = significanceHeuristic; if (!valueSourceConfig.unmapped()) { this.indexedFieldName = config.fieldContext().field(); fieldType = SearchContext.current().smartNameFieldType(indexedFieldName); } this.filter = filter; }
private ValuesSource.Numeric numericField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); if (script() != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); } return dataSource; }
@Override protected Aggregator doCreateInternal(ValuesSource valuesSource, Aggregator parent, boolean collectsFromSingleBucket, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { if (valuesSource instanceof ValuesSource.Numeric) { return new DiversifiedNumericSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, metaData, (Numeric) valuesSource, maxDocsPerValue); } if (valuesSource instanceof ValuesSource.Bytes) { ExecutionMode execution = null; if (executionHint != null) { execution = ExecutionMode.fromString(executionHint); } // In some cases using ordinals is just not supported: override // it if (execution == null) { execution = ExecutionMode.GLOBAL_ORDINALS; } if ((execution.needsGlobalOrdinals()) && (!(valuesSource instanceof ValuesSource.Bytes.WithOrdinals))) { execution = ExecutionMode.MAP; } return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, context, parent, pipelineAggregators, metaData); } throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field() + "]. It can only be applied to numeric or string fields."); }
private ValuesSource.Numeric numericField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); if (script() != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); } return dataSource; }
MaxAggregator(String name, ValuesSourceConfig<ValuesSource.Numeric> config, ValuesSource.Numeric valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { super(name, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; if (valuesSource != null) { maxes = context.bigArrays().newDoubleArray(1, false); maxes.fill(0, maxes.size(), Double.NEGATIVE_INFINITY); } this.formatter = config.format(); this.pointConverter = getPointReaderOrNull(context, parent, config); if (pointConverter != null) { pointField = config.fieldContext().field(); } else { pointField = null; } }
private ValuesSource.Numeric numericField() throws IOException { if (!(fieldContext().indexFieldData() instanceof IndexNumericFieldData)) { throw new IllegalArgumentException("Expected numeric type on field [" + fieldContext().field() + "], but got [" + fieldContext().fieldType().typeName() + "]"); } ValuesSource.Numeric dataSource = new ValuesSource.Numeric.FieldData((IndexNumericFieldData)fieldContext().indexFieldData()); if (script() != null) { dataSource = new ValuesSource.Numeric.WithScript(dataSource, script()); } return dataSource; }
MinAggregator(String name, ValuesSourceConfig<ValuesSource.Numeric> config, ValuesSource.Numeric valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException { super(name, context, parent, pipelineAggregators, metaData); this.valuesSource = valuesSource; if (valuesSource != null) { mins = context.bigArrays().newDoubleArray(1, false); mins.fill(0, mins.size(), Double.POSITIVE_INFINITY); } this.format = config.format(); this.pointConverter = getPointReaderOrNull(context, parent, config); if (pointConverter != null) { pointField = config.fieldContext().field(); } else { pointField = null; } }