Package org.elasticsearch.index.mapper

Examples of org.elasticsearch.index.mapper.ContentPath


        buildMapping(mapperBuilder);

        XContentBuilder contentBuilder = JsonXContent.contentBuilder();

        contentBuilder.startObject();
        mapperBuilder.build(new BuilderContext(null, new ContentPath())).toXContent(contentBuilder, null);
        contentBuilder.endObject();

        // cache mapping as string for easy debugging
        _mapping = contentBuilder.string();
      }
View Full Code Here


        buildMapping(mapperBuilder);

        XContentBuilder contentBuilder = JsonXContent.contentBuilder();

        contentBuilder.startObject();
        mapperBuilder.build(new BuilderContext(null, new ContentPath())).toXContent(contentBuilder, null,
            new ToXContent() {

              @Override
              public XContentBuilder toXContent(XContentBuilder builder, Params params)
                  throws IOException {
View Full Code Here

        buildMapping(mapperBuilder);

        XContentBuilder contentBuilder = JsonXContent.contentBuilder();

        contentBuilder.startObject();
        mapperBuilder.build(new BuilderContext(null, new ContentPath())).toXContent(contentBuilder,
            EMPTY_PARAMS, new ToXContent() {

              @Override
              public XContentBuilder toXContent(XContentBuilder builder, Params params)
                  throws IOException {
View Full Code Here

    public void testGetForFieldDefaults() {
        final IndexService indexService = createIndex("test");
        final IndexFieldDataService ifdService = indexService.fieldData();
        for (boolean docValues : Arrays.asList(true, false)) {
            final BuilderContext ctx = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1));
            final StringFieldMapper stringMapper = new StringFieldMapper.Builder("string").tokenized(false).fieldDataSettings(docValues ? DOC_VALUES_SETTINGS : ImmutableSettings.EMPTY).build(ctx);
            ifdService.clear();
            IndexFieldData<?> fd = ifdService.getForField(stringMapper);
            if (docValues) {
                assertTrue(fd instanceof SortedSetDVOrdinalsIndexFieldData);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testByPassDocValues() {
        final IndexService indexService = createIndex("test");
        final IndexFieldDataService ifdService = indexService.fieldData();
        final BuilderContext ctx = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1));
        final StringFieldMapper stringMapper = MapperBuilders.stringField("string").tokenized(false).fieldDataSettings(DOC_VALUES_SETTINGS).fieldDataSettings(ImmutableSettings.builder().put("format", "fst").build()).build(ctx);
        ifdService.clear();
        IndexFieldData<?> fd = ifdService.getForField(stringMapper);
        assertTrue(fd instanceof FSTBytesIndexFieldData);
View Full Code Here

    }

    public void testChangeFieldDataFormat() throws Exception {
        final IndexService indexService = createIndex("test");
        final IndexFieldDataService ifdService = indexService.fieldData();
        final BuilderContext ctx = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1));
        final StringFieldMapper mapper1 = MapperBuilders.stringField("s").tokenized(false).fieldDataSettings(ImmutableSettings.builder().put(FieldDataType.FORMAT_KEY, "paged_bytes").build()).build(ctx);
        final IndexWriter writer = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(new KeywordAnalyzer()));
        Document doc = new Document();
        doc.add(new StringField("s", "thisisastring", Store.NO));
        writer.addDocument(doc);
View Full Code Here

        return getForField(getFieldDataType(), fieldName);
    }

    public <IFD extends IndexFieldData<?>> IFD getForField(FieldDataType type, String fieldName) {
        final FieldMapper<?> mapper;
        final BuilderContext context = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1));
        if (type.getType().equals("string")) {
            mapper = MapperBuilders.stringField(fieldName).tokenized(false).fieldDataSettings(type.getSettings()).build(context);
        } else if (type.getType().equals("float")) {
            mapper = MapperBuilders.floatField(fieldName).fieldDataSettings(type.getSettings()).build(context);
        } else if (type.getType().equals("double")) {
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.mapper.ContentPath

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.