Examples of XContentType


Examples of org.elasticsearch.common.xcontent.XContentType

                sourceAsMap = nestedParsedSource.get(nested.getOffset());
                nested = nested.getChild();
            } while (nested != null);

            context.lookup().source().setNextSource(sourceAsMap);
            XContentType contentType = tuple.v1();
            BytesReference nestedSource = contentBuilder(contentType).map(sourceAsMap).bytes();
            context.lookup().source().setNextSource(nestedSource);
            context.lookup().source().setNextSourceContentType(contentType);
        }
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentType

        try (Directory dir = newDirectory(file.getParentFile())) {
            try (final IndexInput indexInput = dir.openInput(file.getName(), IOContext.DEFAULT)) {
                 // We checksum the entire file before we even go and parse it. If it's corrupted we barf right here.
                CodecUtil.checksumEntireFile(indexInput);
                CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, STATE_FILE_VERSION, STATE_FILE_VERSION);
                final XContentType xContentType = XContentType.values()[indexInput.readInt()];
                final long version = indexInput.readLong();
                if (version != expectedVersion) {
                    throw new CorruptStateException("State version mismatch expected: " + expectedVersion + " but was: " + version);
                }
                long filePointer = indexInput.getFilePointer();
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentType

        Tuple<XContentType, Map<String, Object>> sourceAndContent = XContentHelper.convertToMap(getResult.internalSourceRef(), true);
        String operation = null;
        String timestamp;
        Long ttl = null;
        final Map<String, Object> updatedSourceAsMap;
        final XContentType updateSourceContentType = sourceAndContent.v1();
        String routing = getResult.getFields().containsKey(RoutingFieldMapper.NAME) ? getResult.field(RoutingFieldMapper.NAME).getValue().toString() : null;
        String parent = getResult.getFields().containsKey(ParentFieldMapper.NAME) ? getResult.field(ParentFieldMapper.NAME).getValue().toString() : null;

        if (request.script() == null && request.doc() != null) {
            IndexRequest indexRequest = request.doc();
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentType

        return detectNoop;
    }

    public UpdateRequest source(BytesReference source) throws Exception {
        ScriptParameterParser scriptParameterParser = new ScriptParameterParser();
        XContentType xContentType = XContentFactory.xContentType(source);
        try (XContentParser parser = XContentFactory.xContent(xContentType).createParser(source)) {
            XContentParser.Token token = parser.nextToken();
            if (token == null) {
                return this;
            }
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentType

    public static void main(String[] args) throws Exception {
        byte[] jsonResource = Resources.toByteArray(
                Resources.getResource(XContentTests.class, "post_cluster_by_url.json"));

        XContent xcontent = XContentFactory.xContent(jsonResource);
        XContentType type = XContentType.YAML; // xcontent.type();
        XContentParser parser = xcontent.createParser(jsonResource);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XContentBuilder builder = XContentFactory.contentBuilder(type, baos).copyCurrentStructure(parser);
        builder.close();
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.