Package org.elasticsearch.index.fielddata

Examples of org.elasticsearch.index.fielddata.IndexNumericFieldData


                            + tsFieldMapper.fieldDataType().getType());
        }

        FieldMapper valueFieldMapper = context.mapperService().smartNameFieldMapper(valueFieldName);
        if (valueFieldMapper.fieldDataType().getType().equals("int") || valueFieldMapper.fieldDataType().getType().equals("long")) {
            IndexNumericFieldData valueFieldData = context.fieldData().getForField(valueFieldMapper);
            IndexNumericFieldData keyFieldData = context.fieldData().getForField(keyFieldMapper);
            IndexNumericFieldData tsFieldData = context.fieldData().getForField(tsFieldMapper);

            return new LatestFacetExecutor(keyFieldData, valueFieldData, tsFieldData, size, start,context.cacheRecycler());
        } else {
            throw new FacetPhaseExecutionException(facetName, "value field  is not of type int or long");
        }
View Full Code Here


        if (distinctFieldMapper.fieldDataType().getType().equals("string")) {
            PagedBytesIndexFieldData distinctFieldData = context.fieldData().getForField(distinctFieldMapper);
            PackedArrayIndexFieldData keyIndexFieldData = context.fieldData().getForField(keyMapper);
            return new StringDistinctDateHistogramFacetExecutor(keyIndexFieldData, distinctFieldData, dateTime, interval, comparatorType, context.cacheRecycler());
        } else if (distinctFieldMapper.fieldDataType().getType().equals("long"))  {
            IndexNumericFieldData distinctFieldData = context.fieldData().getForField(distinctFieldMapper);
            IndexNumericFieldData keyIndexFieldData = context.fieldData().getForField(keyMapper);
            return new LongDistinctDateHistogramFacetExecutor(keyIndexFieldData, distinctFieldData, dateTime, interval, comparatorType, context.cacheRecycler());
        } else {
            throw new FacetPhaseExecutionException(facetName, "distinct field [" + distinctField + "] is not of type string or long");
        }
    }
View Full Code Here

    /**
     * A terms filter based on the field data cache for numeric fields.
     */
    @Override
    public Filter fieldDataTermsFilter(List values, @Nullable QueryParseContext context) {
        IndexNumericFieldData fieldData = context.getForField(this);
        if (fieldData.getNumericType().isFloatingPoint()) {
            // create with initial size large enough to avoid rehashing
            DoubleOpenHashSet terms =
                    new DoubleOpenHashSet((int) (values.size() * (1 + DoubleOpenHashSet.DEFAULT_LOAD_FACTOR)));
            for (int i = 0, len = values.size(); i < len; i++) {
                terms.add(parseDoubleValue(values.get(i)));
View Full Code Here

        }
        if (!scaleFound || !refFound) {
            throw new ElasticsearchParseException("Both " + DecayFunctionBuilder.SCALE + " and " + DecayFunctionBuilder.ORIGIN
                    + " must be set for numeric fields.");
        }
        IndexNumericFieldData numericFieldData = parseContext.getForField(mapper);
        return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
    }
View Full Code Here

        }
        TimeValue val = TimeValue.parseTimeValue(scaleString, TimeValue.timeValueHours(24));
        double scale = val.getMillis();
        val = TimeValue.parseTimeValue(offsetString, TimeValue.timeValueHours(24));
        double offset = val.getMillis();
        IndexNumericFieldData numericFieldData = parseContext.getForField(dateFieldMapper);
        return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
    }
View Full Code Here

        @Override
        public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
            // make sure there are terms to filter on
            if (terms == null || terms.isEmpty()) return null;

            IndexNumericFieldData numericFieldData = (IndexNumericFieldData) fieldData;
            if (!numericFieldData.getNumericType().isFloatingPoint()) {
                final SortedNumericDocValues values = numericFieldData.load(context).getLongValues(); // load fielddata
                return new DocValuesDocIdSet(context.reader().maxDoc(), acceptDocs) {
                    @Override
                    protected boolean matchDoc(int doc) {
                        values.setDocument(doc);
                        final int numVals = values.count();
View Full Code Here

        public DocIdSet getDocIdSet(LeafReaderContext context, Bits acceptDocs) throws IOException {
            // make sure there are terms to filter on
            if (terms == null || terms.isEmpty()) return null;

            // verify we have a floating point numeric fielddata
            IndexNumericFieldData indexNumericFieldData = (IndexNumericFieldData) fieldData;
            if (indexNumericFieldData.getNumericType().isFloatingPoint()) {
                final SortedNumericDoubleValues values = indexNumericFieldData.load(context).getDoubleValues(); // load fielddata
                return new DocValuesDocIdSet(context.reader().maxDoc(), acceptDocs) {
                    @Override
                    protected boolean matchDoc(int doc) {
                        values.setDocument(doc);
                        final int numVals = values.count();
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.fielddata.IndexNumericFieldData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.