org.elasticsearch.search.MultiValueMode Java Examples

The following examples show how to use org.elasticsearch.search.MultiValueMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaxAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
}
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues allValues = valuesSource.doubleValues(ctx);
    final NumericDoubleValues values = MultiValueMode.MAX.select(allValues, Double.NEGATIVE_INFINITY);
    return new LeafBucketCollectorBase(sub, allValues) {

        @Override
        public void collect(int doc, long bucket) throws IOException {
            if (bucket >= maxes.size()) {
                long from = maxes.size();
                maxes = bigArrays.grow(maxes, bucket + 1);
                maxes.fill(from, maxes.size(), Double.NEGATIVE_INFINITY);
            }
            final double value = values.get(doc);
            double max = maxes.get(bucket);
            max = Math.max(max, value);
            maxes.set(bucket, max);
        }

    };
}
 
Example #2
Source File: MultiValuesSource.java    From elasticsearch-linear-regression with Apache License 2.0 6 votes vote down vote up
private MultiValuesSource(List<? extends NamedValuesSourceSpec<VS>> valuesSources,
    MultiValueMode multiValueMode, VS[] emptyArray) {
  if (valuesSources != null) {
    this.names = new String[valuesSources.size()];
    List<VS> valuesList = new ArrayList<VS>(valuesSources.size());
    int i = 0;
    for (NamedValuesSourceSpec<VS> spec : valuesSources) {
      this.names[i++] = spec.getName();
      valuesList.add(spec.getValuesSource());
    }
    this.values = valuesList.toArray(emptyArray);
  } else {
    this.names = new String[0];
    this.values = emptyArray;
  }
  this.multiValueMode = multiValueMode;
}
 
Example #3
Source File: PredictionAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 6 votes vote down vote up
@Override
protected MultiValuesSourceAggregatorFactory<Numeric, ?> innerInnerBuild(
    final SearchContext context,
    final List<NamedValuesSourceConfigSpec<Numeric>> configs, final MultiValueMode multiValueMode,
    final AggregatorFactory<?> parent, final Builder subFactoriesBuilder) throws IOException {
  if (this.inputs == null || this.inputs.length != configs.size() - 1) {
    throw new IllegalArgumentException(
        "[inputs] must have [" + (configs.size() - 1)
            + "] values as much as the number of feature fields: ["
            + this.name
            + "]");
  }
  return new PredictionAggregatorFactory(this.name, configs, multiValueMode, this.inputs,
      context,
      parent,
      subFactoriesBuilder, this.metaData);
}
 
Example #4
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public AbstractDistanceScoreFunction(double userSuppiedScale, double decay, double offset, DecayFunction func, MultiValueMode mode) {
    super(CombineFunction.MULT);
    this.mode = mode;
    if (userSuppiedScale <= 0.0) {
        throw new IllegalArgumentException(FunctionScoreQueryParser.NAME + " : scale must be > 0.0.");
    }
    if (decay <= 0.0 || decay >= 1.0) {
        throw new IllegalArgumentException(FunctionScoreQueryParser.NAME
                + " : decay must be in the range [0..1].");
    }
    this.scale = func.processScale(userSuppiedScale, decay);
    this.func = func;
    if (offset < 0.0d) {
        throw new IllegalArgumentException(FunctionScoreQueryParser.NAME + " : offset must be > 0.0");
    }
    this.offset = offset;
}
 
Example #5
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected NumericDoubleValues distance(LeafReaderContext context) {
    final SortedNumericDoubleValues doubleValues = fieldData.load(context).getDoubleValues();
    return mode.select(new MultiValueMode.UnsortedNumericDoubleValues() {
        @Override
        public int count() {
            return doubleValues.count();
        }

        @Override
        public void setDocument(int docId) {
            doubleValues.setDocument(docId);
        }

        @Override
        public double valueAt(int index) {
            return Math.max(0.0d, Math.abs(doubleValues.valueAt(index) - origin) - offset);
        }
    }, 0.0);
}
 
Example #6
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected NumericDoubleValues distance(LeafReaderContext context) {
    final MultiGeoPointValues geoPointValues = fieldData.load(context).getGeoPointValues();
    return mode.select(new MultiValueMode.UnsortedNumericDoubleValues() {
        @Override
        public int count() {
            return geoPointValues.count();
        }

        @Override
        public void setDocument(int docId) {
            geoPointValues.setDocument(docId);
        }

        @Override
        public double valueAt(int index) {
            GeoPoint other = geoPointValues.valueAt(index);
            return Math.max(0.0d, distFunction.calculate(origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS) - offset);
        }
    }, 0.0);
}
 
Example #7
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
private AbstractDistanceScoreFunction parseVariable(String fieldName, XContentParser parser, QueryParseContext parseContext, MultiValueMode mode) throws IOException {

        // now, the field must exist, else we cannot read the value for
        // the doc later
        MappedFieldType fieldType = parseContext.fieldMapper(fieldName);
        if (fieldType == null) {
            throw new QueryParsingException(parseContext, "unknown field [{}]", fieldName);
        }

        // dates and time need special handling
        parser.nextToken();
        if (fieldType instanceof DateFieldMapper.DateFieldType) {
            return parseDateVariable(fieldName, parser, parseContext, (DateFieldMapper.DateFieldType) fieldType, mode);
        } else if (fieldType instanceof GeoPointFieldMapper.GeoPointFieldType) {
            return parseGeoVariable(fieldName, parser, parseContext, (GeoPointFieldMapper.GeoPointFieldType) fieldType, mode);
        } else if (fieldType instanceof NumberFieldMapper.NumberFieldType) {
            return parseNumberVariable(fieldName, parser, parseContext, (NumberFieldMapper.NumberFieldType) fieldType, mode);
        } else {
            throw new QueryParsingException(parseContext, "field [{}] is of type [{}], but only numeric types are supported.", fieldName, fieldType);
        }
    }
 
Example #8
Source File: MinAggregator.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx,
        final LeafBucketCollector sub) throws IOException {
    if (valuesSource == null) {
        return LeafBucketCollector.NO_OP_COLLECTOR;
    }
    final BigArrays bigArrays = context.bigArrays();
    final SortedNumericDoubleValues allValues = valuesSource.doubleValues(ctx);
    final NumericDoubleValues values = MultiValueMode.MIN.select(allValues, Double.POSITIVE_INFINITY);
    return new LeafBucketCollectorBase(sub, allValues) {

        @Override
        public void collect(int doc, long bucket) throws IOException {
            if (bucket >= mins.size()) {
                long from = mins.size();
                mins = bigArrays.grow(mins, bucket + 1);
                mins.fill(from, mins.size(), Double.POSITIVE_INFINITY);
            }
            final double value = values.get(doc);
            double min = mins.get(bucket);
            min = Math.min(min, value);
            mins.set(bucket, min);
        }

    };
}
 
Example #9
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private AbstractDistanceScoreFunction parseNumberVariable(String fieldName, XContentParser parser, QueryParseContext parseContext,
        NumberFieldMapper.NumberFieldType fieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    double scale = 0;
    double origin = 0;
    double decay = 0.5;
    double offset = 0.0d;
    boolean scaleFound = false;
    boolean refFound = false;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (parameterName.equals(DecayFunctionBuilder.SCALE)) {
            scale = parser.doubleValue();
            scaleFound = true;
        } else if (parameterName.equals(DecayFunctionBuilder.DECAY)) {
            decay = parser.doubleValue();
        } else if (parameterName.equals(DecayFunctionBuilder.ORIGIN)) {
            origin = parser.doubleValue();
            refFound = true;
        } else if (parameterName.equals(DecayFunctionBuilder.OFFSET)) {
            offset = parser.doubleValue();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    if (!scaleFound || !refFound) {
        throw new ElasticsearchParseException("both [{}] and [{}] must be set for numeric fields.", DecayFunctionBuilder.SCALE, DecayFunctionBuilder.ORIGIN);
    }
    IndexNumericFieldData numericFieldData = parseContext.getForField(fieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 
Example #10
Source File: SortSymbolVisitor.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * generate a SortField from a Reference symbol.
 *
 * the implementation is similar to what {@link org.elasticsearch.search.sort.SortParseElement}
 * does.
 */
@Override
public SortField visitReference(final Reference symbol, final SortSymbolContext context) {
    // can't use the SortField(fieldName, type) constructor
    // because values are saved using docValues and therefore they're indexed in lucene as binary and not
    // with the reference valueType.
    // this is why we use a custom comparator source with the same logic as ES

    ColumnIdent columnIdent = symbol.info().ident().columnIdent();

    if (columnIdent.isColumn()) {
        if (SortParseElement.SCORE_FIELD_NAME.equals(columnIdent.name())) {
            return !context.reverseFlag ? SORT_SCORE_REVERSE : SortParseElement.SORT_SCORE;
        } else if (DocSysColumns.RAW.equals(columnIdent) || DocSysColumns.ID.equals(columnIdent)) {
            return customSortField(DocSysColumns.nameForLucene(columnIdent), symbol, context,
                    LUCENE_TYPE_MAP.get(symbol.valueType()), false);
        }
    }

    MultiValueMode sortMode = context.reverseFlag ? MultiValueMode.MAX : MultiValueMode.MIN;

    String indexName;
    IndexFieldData.XFieldComparatorSource fieldComparatorSource;
    MappedFieldType fieldType = context.context.mapperService().smartNameFieldType(columnIdent.fqn());
    if (fieldType == null){
        indexName = columnIdent.fqn();
        fieldComparatorSource = new NullFieldComparatorSource(LUCENE_TYPE_MAP.get(symbol.valueType()), context.reverseFlag, context.nullFirst);
    } else {
        indexName = fieldType.names().indexName();
        fieldComparatorSource = context.context.fieldData()
                .getForField(fieldType)
                .comparatorSource(SortOrder.missing(context.reverseFlag, context.nullFirst), sortMode, null);
    }
    return new SortField(
            indexName,
            fieldComparatorSource,
            context.reverseFlag
    );
}
 
Example #11
Source File: PredictionAggregatorFactory.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public PredictionAggregatorFactory(final String name,
    final List<NamedValuesSourceConfigSpec<Numeric>> configs, final MultiValueMode multiValueMode,
    final double[] inputs, final SearchContext context, final AggregatorFactory<?> parent,
    final Builder subFactoriesBuilder,
    final Map<String, Object> metaData) throws IOException {
  super(name, configs, context, parent, subFactoriesBuilder, metaData);
  this.multiValueMode = multiValueMode;
  this.inputs = inputs;
}
 
Example #12
Source File: PredictionAggregator.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public PredictionAggregator(final String name,
    final List<NamedValuesSourceSpec<Numeric>> valuesSources,
    final SearchContext context,
    final Aggregator parent,
    final MultiValueMode multiValueMode,
    final double[] inputs, final List<PipelineAggregator> pipelineAggregators,
    final Map<String, Object> metaData) throws IOException {
  super(name, valuesSources, context, parent, multiValueMode, pipelineAggregators, metaData);
  this.inputs = inputs;
}
 
Example #13
Source File: StatsAggregatorFactory.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public StatsAggregatorFactory(String name,
    List<NamedValuesSourceConfigSpec<Numeric>> configs, MultiValueMode multiValueMode,
    SearchContext context, AggregatorFactory<?> parent,
    AggregatorFactories.Builder subFactoriesBuilder,
    Map<String, Object> metaData) throws IOException {
  super(name, configs, context, parent, subFactoriesBuilder, metaData);
  this.multiValueMode = multiValueMode;
}
 
Example #14
Source File: StatsAggregator.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public StatsAggregator(final String name,
    final List<NamedValuesSourceSpec<Numeric>> valuesSources,
    final SearchContext context,
    final Aggregator parent,
    final MultiValueMode multiValueMode,
    final List<PipelineAggregator> pipelineAggregators,
    final Map<String, Object> metaData) throws IOException {
  super(name, valuesSources, context, parent, multiValueMode, pipelineAggregators, metaData);
}
 
Example #15
Source File: StatsAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
@Override
protected StatsAggregatorFactory innerInnerBuild(final SearchContext context,
    final List<NamedValuesSourceConfigSpec<Numeric>> configs, final MultiValueMode multiValueMode,
    final AggregatorFactory<?> parent, final AggregatorFactories.Builder subFactoriesBuilder)
    throws IOException {
  return new StatsAggregatorFactory(this.name, configs, multiValueMode, context, parent,
      subFactoriesBuilder, this.metaData);
}
 
Example #16
Source File: BaseParser.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
@Override
protected B createFactory(final String aggregationName,
    final ValuesSourceType valuesSourceType,
    final ValueType targetValueType, final Map<ParseField, Object> otherOptions) {
  final B builder = createInnerFactory(aggregationName, otherOptions);
  final String mode = (String) otherOptions.get(MULTIVALUE_MODE_FIELD);
  if (mode != null) {
    builder.multiValueMode(MultiValueMode.fromString(mode));
  }
  return builder;
}
 
Example #17
Source File: BaseSamplingAggregator.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public BaseSamplingAggregator(final String name,
    final List<NamedValuesSourceSpec<Numeric>> valuesSources,
    final SearchContext context,
    final Aggregator parent, final MultiValueMode multiValueMode,
    final List<PipelineAggregator> pipelineAggregators,
    final Map<String, Object> metaData) throws IOException {
  super(name, context, parent, pipelineAggregators, metaData);
  if (valuesSources != null && !valuesSources.isEmpty()) {
    this.valuesSources = new NumericMultiValuesSource(valuesSources, multiValueMode);
    this.samplings = context.bigArrays().newObjectArray(1);
    this.fieldsCount = this.valuesSources.fieldNames().length;
  } else {
    this.valuesSources = null;
  }
}
 
Example #18
Source File: ParentChildAtomicFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public SortedDocValues getOrdinalsValues(String type) {
    AtomicOrdinalsFieldData atomicFieldData = typeToIds.get(type);
    if (atomicFieldData != null) {
        return MultiValueMode.MIN.select(atomicFieldData.getOrdinalsValues());
    } else {
        return DocValues.emptySorted();
    }
}
 
Example #19
Source File: BinaryDVNumericIndexFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource comparatorSource(final Object missingValue, final MultiValueMode sortMode, Nested nested) {
    switch (numericType) {
    case FLOAT:
        return new FloatValuesComparatorSource(this, missingValue, sortMode, nested);
    case DOUBLE:
        return new DoubleValuesComparatorSource(this, missingValue, sortMode, nested);
    default:
        assert !numericType.isFloatingPoint();
        return new LongValuesComparatorSource(this, missingValue, sortMode, nested);
    }
}
 
Example #20
Source File: SortedNumericDVIndexFieldData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource comparatorSource(Object missingValue, MultiValueMode sortMode, Nested nested) {
    switch (numericType) {
        case FLOAT:
            return new FloatValuesComparatorSource(this, missingValue, sortMode, nested);
        case DOUBLE:
            return new DoubleValuesComparatorSource(this, missingValue, sortMode, nested);
        default:
            assert !numericType.isFloatingPoint();
            return new LongValuesComparatorSource(this, missingValue, sortMode, nested);
    }
}
 
Example #21
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * Parses bodies of the kind
 *
 * <pre>
 * <code>
 * {
 *      "fieldname1" : {
 *          "origin" = "someValue",
 *          "scale" = "someValue"
 *      }
 *
 * }
 * </code>
 * </pre>
 *
 * */
@Override
public ScoreFunction parse(QueryParseContext parseContext, XContentParser parser) throws IOException, QueryParsingException {
    String currentFieldName;
    XContentParser.Token token;
    AbstractDistanceScoreFunction scoreFunction;
    String multiValueMode = "MIN";
    XContentBuilder variableContent = XContentFactory.jsonBuilder();
    String fieldName = null;
    while ((token = parser.nextToken()) == XContentParser.Token.FIELD_NAME) {
        currentFieldName = parser.currentName();
        token = parser.nextToken();
        if (token == XContentParser.Token.START_OBJECT) {
            variableContent.copyCurrentStructure(parser);
            fieldName = currentFieldName;
        } else if (parseContext.parseFieldMatcher().match(currentFieldName, MULTI_VALUE_MODE)) {
            multiValueMode = parser.text();
        } else {
            throw new ElasticsearchParseException("malformed score function score parameters.");
        }
    }
    if (fieldName == null) {
        throw new ElasticsearchParseException("malformed score function score parameters.");
    }
    XContentParser variableParser = XContentFactory.xContent(variableContent.string()).createParser(variableContent.string());
    scoreFunction = parseVariable(fieldName, variableParser, parseContext, MultiValueMode.fromString(multiValueMode.toUpperCase(Locale.ROOT)));
    return scoreFunction;
}
 
Example #22
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private AbstractDistanceScoreFunction parseGeoVariable(String fieldName, XContentParser parser, QueryParseContext parseContext,
        GeoPointFieldMapper.GeoPointFieldType fieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    GeoPoint origin = new GeoPoint();
    String scaleString = null;
    String offsetString = "0km";
    double decay = 0.5;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (parameterName.equals(DecayFunctionBuilder.SCALE)) {
            scaleString = parser.text();
        } else if (parameterName.equals(DecayFunctionBuilder.ORIGIN)) {
            origin = GeoUtils.parseGeoPoint(parser);
        } else if (parameterName.equals(DecayFunctionBuilder.DECAY)) {
            decay = parser.doubleValue();
        } else if (parameterName.equals(DecayFunctionBuilder.OFFSET)) {
            offsetString = parser.text();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    if (origin == null || scaleString == null) {
        throw new ElasticsearchParseException("[{}] and [{}] must be set for geo fields.", DecayFunctionBuilder.ORIGIN, DecayFunctionBuilder.SCALE);
    }
    double scale = DistanceUnit.DEFAULT.parse(scaleString, DistanceUnit.DEFAULT);
    double offset = DistanceUnit.DEFAULT.parse(offsetString, DistanceUnit.DEFAULT);
    IndexGeoPointFieldData indexFieldData = parseContext.getForField(fieldType);
    return new GeoFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), indexFieldData, mode);

}
 
Example #23
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private AbstractDistanceScoreFunction parseDateVariable(String fieldName, XContentParser parser, QueryParseContext parseContext,
        DateFieldMapper.DateFieldType dateFieldType, MultiValueMode mode) throws IOException {
    XContentParser.Token token;
    String parameterName = null;
    String scaleString = null;
    String originString = null;
    String offsetString = "0d";
    double decay = 0.5;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            parameterName = parser.currentName();
        } else if (parameterName.equals(DecayFunctionBuilder.SCALE)) {
            scaleString = parser.text();
        } else if (parameterName.equals(DecayFunctionBuilder.ORIGIN)) {
            originString = parser.text();
        } else if (parameterName.equals(DecayFunctionBuilder.DECAY)) {
            decay = parser.doubleValue();
        } else if (parameterName.equals(DecayFunctionBuilder.OFFSET)) {
            offsetString = parser.text();
        } else {
            throw new ElasticsearchParseException("parameter [{}] not supported!", parameterName);
        }
    }
    long origin = SearchContext.current().nowInMillis();
    if (originString != null) {
        origin = dateFieldType.parseToMilliseconds(originString, false, null, null);
    }

    if (scaleString == null) {
        throw new ElasticsearchParseException("[{}] must be set for date fields.", DecayFunctionBuilder.SCALE);
    }
    TimeValue val = TimeValue.parseTimeValue(scaleString, TimeValue.timeValueHours(24), getClass().getSimpleName() + ".scale");
    double scale = val.getMillis();
    val = TimeValue.parseTimeValue(offsetString, TimeValue.timeValueHours(24), getClass().getSimpleName() + ".offset");
    double offset = val.getMillis();
    IndexNumericFieldData numericFieldData = parseContext.getForField(dateFieldType);
    return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
}
 
Example #24
Source File: DecayFunctionBuilder.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public ScoreFunctionBuilder setMultiValueMode(String multiValueMode) {
    this.multiValueMode = MultiValueMode.fromString(multiValueMode.toUpperCase(Locale.ROOT));
    return this;
}
 
Example #25
Source File: MultiValuesSource.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
public GeoPointValuesSource(List<NamedValuesSourceSpec<ValuesSource.GeoPoint>> valuesSources,
    MultiValueMode multiValueMode) {
  super(valuesSources, multiValueMode, new ValuesSource.GeoPoint[0]);
}
 
Example #26
Source File: MultiValuesSource.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
public BytesMultiValuesSource(List<NamedValuesSourceSpec<ValuesSource.Bytes>> valuesSources,
    MultiValueMode multiValueMode) {
  super(valuesSources, multiValueMode, new ValuesSource.Bytes[0]);
}
 
Example #27
Source File: MultiValuesSource.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
public NumericMultiValuesSource(List<NamedValuesSourceSpec<Numeric>> valuesSources,
    MultiValueMode multiValueMode) {
  super(valuesSources, multiValueMode, new ValuesSource.Numeric[0]);
}
 
Example #28
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public GeoFieldDataScoreFunction(GeoPoint origin, double scale, double decay, double offset, DecayFunction func,
        IndexGeoPointFieldData fieldData, MultiValueMode mode) {
    super(scale, decay, offset, func, mode);
    this.origin = origin;
    this.fieldData = fieldData;
}
 
Example #29
Source File: SortParseElement.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
private static MultiValueMode resolveDefaultSortMode(boolean reverse) {
    return reverse ? MultiValueMode.MAX : MultiValueMode.MIN;
}
 
Example #30
Source File: DecayFunctionParser.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public NumericFieldDataScoreFunction(double origin, double scale, double decay, double offset, DecayFunction func,
        IndexNumericFieldData fieldData, MultiValueMode mode) {
    super(scale, decay, offset, func, mode);
    this.fieldData = fieldData;
    this.origin = origin;
}