Package org.elasticsearch.index.mapper.core

Examples of org.elasticsearch.index.mapper.core.StringFieldMapper


        @Override public AttachmentMapper build(BuilderContext context) {
            ContentPath.Type origPathType = context.path().pathType();
            context.path().pathType(pathType);

            // create the content mapper under the actual name
            StringFieldMapper contentMapper = contentBuilder.build(context);

            // create the DC one under the name
            context.path().add(name);
            DateFieldMapper dateMapper = dateBuilder.build(context);
            StringFieldMapper authorMapper = authorBuilder.build(context);
            StringFieldMapper titleMapper = titleBuilder.build(context);
            StringFieldMapper keywordsMapper = keywordsBuilder.build(context);
            StringFieldMapper contentTypeMapper = contentTypeBuilder.build(context);
            context.path().remove();

            context.path().pathType(origPathType);

            return new AttachmentMapper(name, pathType, contentMapper, dateMapper, titleMapper, authorMapper, keywordsMapper, contentTypeMapper);
View Full Code Here


                    lonMapperBuilder.precisionStep(precisionStep);
                }
                latMapper = (NumberFieldMapper) latMapperBuilder.includeInAll(false).store(store).build(context);
                lonMapper = (NumberFieldMapper) lonMapperBuilder.includeInAll(false).store(store).build(context);
            }
            StringFieldMapper geohashMapper = null;
            if (enableGeoHash) {
                geohashMapper = stringField(Names.GEOHASH).index(Field.Index.NOT_ANALYZED).includeInAll(false).omitNorms(true).omitTermFreqAndPositions(true).build(context);
            }
            context.path().remove();
View Full Code Here

        DocumentMapper docMapper = createIndex("test").mapperService().documentMapperParser().parse(mapping);
        FieldMapper fieldMapper = docMapper.mappers().name("copy_test").mapper();
        assertThat(fieldMapper, instanceOf(StringFieldMapper.class));

        // Check json serialization
        StringFieldMapper stringFieldMapper = (StringFieldMapper) fieldMapper;
        XContentBuilder builder = jsonBuilder().startObject();
        stringFieldMapper.toXContent(builder, ToXContent.EMPTY_PARAMS).endObject();
        builder.close();
        Map<String, Object> serializedMap = JsonXContent.jsonXContent.createParser(builder.bytes()).mapAndClose();
        Map<String, Object> copyTestMap = (Map<String, Object>) serializedMap.get("copy_test");
        assertThat(copyTestMap.get("type").toString(), is("string"));
        List<String> copyToList = (List<String>) copyTestMap.get("copy_to");
View Full Code Here

    public static Filter create(QueryParseContext context, GeoPointFieldMapper fieldMapper, String geohash, @Nullable List<CharSequence> geohashes) {
        if (fieldMapper.geoHashStringMapper() == null) {
            throw new ElasticsearchIllegalArgumentException("geohash filter needs geohash_prefix to be enabled");
        }

        StringFieldMapper geoHashMapper = fieldMapper.geoHashStringMapper();
        if (geohashes == null || geohashes.size() == 0) {
            return geoHashMapper.termFilter(geohash, context);
        } else {
            geohashes.add(geohash);
            return geoHashMapper.termsFilter(geohashes, context);
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.mapper.core.StringFieldMapper

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.