Package org.elasticsearch.index.mapper

Examples of org.elasticsearch.index.mapper.FieldMapper$Names


        // add type filter if there is exact doc mapper associated with it
        if (smartMappers.hasDocMapper()) {
            setFilter(context.filterCache().cache(smartMappers.docMapper().typeFilter()));
        }

        FieldMapper mapper = smartMappers.mapper();

        indexFieldName = mapper.names().indexName();
        fieldDataType = mapper.fieldDataType();

        if (interval == 1) {
            histoProc = new DateHistogramProc();
        } else {
            histoProc = new IntervalDateHistogramProc(interval);
View Full Code Here


        // add type filter if there is exact doc mapper associated with it
        if (smartMappers.hasDocMapper()) {
            setFilter(context.filterCache().cache(smartMappers.docMapper().typeFilter()));
        }

        FieldMapper mapper = smartMappers.mapper();

        indexFieldName = mapper.names().indexName();
        fieldDataType = mapper.fieldDataType();

        histoProc = new HistogramProc(interval);
    }
View Full Code Here

        }

        keyIndexFieldName = smartMappers.mapper().names().indexName();
        keyFieldDataType = smartMappers.mapper().fieldDataType();

        FieldMapper mapper = context.mapperService().smartNameFieldMapper(valueFieldName);
        if (mapper == null) {
            throw new FacetPhaseExecutionException(facetName, "No mapping found for value_field [" + valueFieldName + "]");
        }
        valueIndexFieldName = mapper.names().indexName();
        valueFieldDataType = mapper.fieldDataType();

        histoProc = new HistogramProc(interval);
    }
View Full Code Here

    @Override public Object get(Object key) {
        // assume its a string...
        String fieldName = key.toString();
        FieldData fieldData = localCacheFieldData.get(fieldName);
        if (fieldData == null) {
            FieldMapper mapper = mapperService.smartNameFieldMapper(fieldName);
            if (mapper == null) {
                throw new ElasticSearchIllegalArgumentException("No field found for [" + fieldName + "]");
            }
            try {
                fieldData = fieldDataCache.cache(mapper.fieldDataType(), reader, mapper.names().indexName());
            } catch (IOException e) {
                throw new ElasticSearchException("Failed to load field data for [" + fieldName + "]", e);
            }
            localCacheFieldData.put(fieldName, fieldData);
        }
View Full Code Here

    public boolean containsKey(Object key) {
        // assume its a string...
        String fieldName = key.toString();
        FieldData fieldData = localCacheFieldData.get(fieldName);
        if (fieldData == null) {
            FieldMapper mapper = mapperService.smartNameFieldMapper(fieldName);
            if (mapper == null) {
                return false;
            }
        }
        return true;
View Full Code Here

        }

        keyIndexFieldName = smartMappers.mapper().names().indexName();
        keyFieldDataType = smartMappers.mapper().fieldDataType();

        FieldMapper mapper = context.mapperService().smartNameFieldMapper(valueFieldName);
        if (mapper == null) {
            throw new FacetPhaseExecutionException(facetName, "No mapping found for value_field [" + valueFieldName + "]");
        }
        valueIndexFieldName = mapper.names().indexName();
        valueFieldDataType = mapper.fieldDataType();

        this.histoProc = new DateHistogramProc(interval);
    }
View Full Code Here

        }
        if (valueField == null && script == null) {
            throw new FacetPhaseExecutionException(facetName, "either [value_field] or [script] are required to be set for terms stats facet");
        }

        FieldMapper keyFieldMapper = context.mapperService().smartNameFieldMapper(keyField);
        if (keyFieldMapper != null) {
            if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.LONG) {
                return new TermsStatsLongFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            } else if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.INT) {
                return new TermsStatsLongFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            } else if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.SHORT) {
                return new TermsStatsLongFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            } else if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.BYTE) {
                return new TermsStatsLongFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            } else if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.DOUBLE) {
                return new TermsStatsDoubleFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            } else if (keyFieldMapper.fieldDataType() == FieldDataType.DefaultTypes.FLOAT) {
                return new TermsStatsDoubleFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
            }
        }

        return new TermsStatsStringFacetCollector(facetName, keyField, valueField, size, comparatorType, context, scriptLang, script, params);
View Full Code Here

        fieldsData = new NumericFieldData[fieldsNames.length];
        indexFieldsNames = new String[fieldsNames.length];


        for (int i = 0; i < fieldsNames.length; i++) {
            FieldMapper mapper = context.mapperService().smartNameFieldMapper(fieldsNames[i]);
            if (mapper == null) {
                throw new FacetPhaseExecutionException(facetName, "No mapping found for field [" + fieldsNames[i] + "]");
            }
            indexFieldsNames[i] = mapper.names().indexName();
            fieldsDataType[i] = mapper.fieldDataType();
        }
    }
View Full Code Here

        if (interval <= 0) {
            throw new FacetPhaseExecutionException(facetName, "[interval] is required to be set for histogram facet");
        }

        if (sFrom != null && sTo != null && keyField != null) {
            FieldMapper mapper = context.mapperService().smartNameFieldMapper(keyField);
            if (mapper == null) {
                throw new FacetPhaseExecutionException(facetName, "No mapping found for key_field [" + keyField + "]");
            }
            long from = ((Number) mapper.valueFromString(sFrom)).longValue();
            long to = ((Number) mapper.valueFromString(sTo)).longValue();

            if (valueField != null) {
                return new BoundedValueHistogramFacetCollector(facetName, keyField, valueField, interval, from, to, comparatorType, context);
            } else if (valueScript != null) {
                return new BoundedValueScriptHistogramFacetCollector(facetName, keyField, scriptLang, valueScript, params, interval, from, to, comparatorType, context);
View Full Code Here

            this.keyFieldName = smartMappers.mapper().names().indexName();
            this.keyFieldDataType = smartMappers.mapper().fieldDataType();
        }

        if (script == null) {
            FieldMapper fieldMapper = context.mapperService().smartNameFieldMapper(valueFieldName);
            if (fieldMapper == null) {
                throw new ElasticSearchIllegalArgumentException("failed to find mappings for [" + valueFieldName + "]");
            }
            this.valueFieldName = fieldMapper.names().indexName();
            this.valueFieldDataType = fieldMapper.fieldDataType();
            this.script = null;
            this.aggregator = new Aggregator();
        } else {
            this.valueFieldName = null;
            this.valueFieldDataType = null;
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.mapper.FieldMapper$Names

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.