Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.XContentBuilder.startObject()


        if (t != null && request.paramAsBoolean("error_trace", false)) {
            builder.startObject("error_trace");
            boolean first = true;
            while (t != null) {
                if (!first) {
                    builder.startObject("cause");
                }
                buildThrowable(t, builder);
                if (!first) {
                    builder.endObject();
                }
View Full Code Here


        testRawField(XContentType.SMILE);
    }

    private void testRawField(XContentType type) throws IOException {
        XContentBuilder builder = XContentFactory.contentBuilder(type);
        builder.startObject();
        builder.field("field1", "value1");
        builder.rawField("_source", XContentFactory.unCachedContentBuilder(type).startObject().field("s_field", "s_value").endObject().copiedBytes());
        builder.field("field2", "value2");
        builder.endObject();
View Full Code Here

            return new MetaData(version, indices.immutableMap(), templates.immutableMap());
        }

        public static String toXContent(MetaData metaData) throws IOException {
            XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
            builder.startObject();
            toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
            builder.endObject();
            return builder.string();
        }
View Full Code Here

                LocalGatewayMetaState stateToWrite = builder.build();
                XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON, fos);
                if (prettyPrint) {
                    xContentBuilder.prettyPrint();
                }
                xContentBuilder.startObject();
                LocalGatewayMetaState.Builder.toXContent(stateToWrite, xContentBuilder, ToXContent.EMPTY_PARAMS);
                xContentBuilder.endObject();
                xContentBuilder.close();
                fos.close();
View Full Code Here

                XContentBuilder xContentBuilder = XContentFactory.contentBuilder(XContentType.JSON, fos);
                if (prettyPrint) {
                    xContentBuilder.prettyPrint();
                }
                xContentBuilder.startObject();
                LocalGatewayStartedShards.Builder.toXContent(stateToWrite, xContentBuilder, ToXContent.EMPTY_PARAMS);
                xContentBuilder.endObject();
                xContentBuilder.close();

                fos.close();
View Full Code Here

            OutputStream os = out;
            if (compress) {
                os = new LZFOutputStream(os);
            }
            XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON, os);
            builder.startObject();
            MetaData.Builder.toXContent(metaData, builder, ToXContent.EMPTY_PARAMS);
            builder.endObject();
            builder.close();
            metaDataBlobContainer.writeBlob(newMetaData, new ByteArrayInputStream(out.unsafeByteArray(), 0, out.size()), out.size());
        } catch (IOException e) {
View Full Code Here

        return commitPoints.iterator();
    }

    public static byte[] toXContent(CommitPoint commitPoint) throws Exception {
        XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).prettyPrint();
        builder.startObject();
        builder.field("version", commitPoint.version());
        builder.field("name", commitPoint.name());
        builder.field("type", commitPoint.type().toString());

        builder.startObject("index_files");
View Full Code Here

        builder.startObject();
        builder.field("version", commitPoint.version());
        builder.field("name", commitPoint.name());
        builder.field("type", commitPoint.type().toString());

        builder.startObject("index_files");
        for (CommitPoint.FileInfo fileInfo : commitPoint.indexFiles()) {
            builder.startObject(fileInfo.name());
            builder.field("physical_name", fileInfo.physicalName());
            builder.field("length", fileInfo.length());
            if (fileInfo.checksum() != null) {
View Full Code Here

        builder.field("name", commitPoint.name());
        builder.field("type", commitPoint.type().toString());

        builder.startObject("index_files");
        for (CommitPoint.FileInfo fileInfo : commitPoint.indexFiles()) {
            builder.startObject(fileInfo.name());
            builder.field("physical_name", fileInfo.physicalName());
            builder.field("length", fileInfo.length());
            if (fileInfo.checksum() != null) {
                builder.field("checksum", fileInfo.checksum());
            }
View Full Code Here

            }
            builder.endObject();
        }
        builder.endObject();

        builder.startObject("translog_files");
        for (CommitPoint.FileInfo fileInfo : commitPoint.translogFiles()) {
            builder.startObject(fileInfo.name());
            builder.field("physical_name", fileInfo.physicalName());
            builder.field("length", fileInfo.length());
            builder.endObject();
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.