Examples of FieldMapper


Examples of org.elasticsearch.index.mapper.FieldMapper

    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

Examples of org.elasticsearch.index.mapper.FieldMapper

        }

        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

Examples of org.elasticsearch.index.mapper.FieldMapper

        }
        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

Examples of org.elasticsearch.index.mapper.FieldMapper

        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

Examples of org.elasticsearch.index.mapper.FieldMapper

        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

Examples of org.elasticsearch.index.mapper.FieldMapper

            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

Examples of org.elasticsearch.index.mapper.FieldMapper

                .startObject()
                .field("date_field", "2011/01/22 00:00:00 +02")
                .endObject()
                .copiedBytes());

        FieldMapper fieldMapper = defaultMapper.mappers().smartNameFieldMapper("date_field");
        assertThat(fieldMapper, instanceOf(DateFieldMapper.class));
    }
View Full Code Here

Examples of org.elasticsearch.index.mapper.FieldMapper

                .field("s_long", "100")
                .field("s_double", "100.0")
                .endObject()
                .copiedBytes());

        FieldMapper mapper = defaultMapper.mappers().smartNameFieldMapper("s_long");
        assertThat(mapper, instanceOf(LongFieldMapper.class));

        mapper = defaultMapper.mappers().smartNameFieldMapper("s_double");
        assertThat(mapper, instanceOf(DoubleFieldMapper.class));
    }
View Full Code Here

Examples of org.elasticsearch.index.mapper.FieldMapper

                .field("s_long", "100")
                .field("s_double", "100.0")
                .endObject()
                .copiedBytes());

        FieldMapper mapper = defaultMapper.mappers().smartNameFieldMapper("s_long");
        assertThat(mapper, instanceOf(StringFieldMapper.class));

        mapper = defaultMapper.mappers().smartNameFieldMapper("s_double");
        assertThat(mapper, instanceOf(StringFieldMapper.class));
    }
View Full Code Here

Examples of org.elasticsearch.index.mapper.FieldMapper

    @Override protected AnalyzeResponse shardOperation(AnalyzeRequest request, int shardId) throws ElasticSearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        Analyzer analyzer = null;
        String field = null;
        if (request.field() != null) {
            FieldMapper fieldMapper = indexService.mapperService().smartNameFieldMapper(request.field());
            if (fieldMapper != null) {
                analyzer = fieldMapper.indexAnalyzer();
                field = fieldMapper.names().indexName();
            }
        }
        if (field == null) {
            field = "_all";
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.