Package org.elasticsearch.common.xcontent

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


    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();

        XContentParser parser = XContentFactory.xContent(type).createParser(builder.copiedBytes());
        assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
View Full Code Here


    public NettyInteractiveResponse(String type, XContentBuilder builder) throws IOException {
        this.type = type;
        XContentBuilder responseBuilder = jsonBuilder()
                .startObject().field("success", true).field("type", type);
        if (builder != null) {
            responseBuilder.rawField("data", builder.bytes());
        }
        responseBuilder.endObject();
        this.response = new TextWebSocketFrame(responseBuilder.string());
    }
View Full Code Here

          .field("number_of_replicas", replicas)
          .endObject();
      // Add mappings
      jsonBuilder.startObject("mappings");
      for (String indiceName : mappings.keySet()) {
        jsonBuilder.rawField(indiceName, mappings.get(indiceName).getBytes());
      }
      jsonBuilder.endObject();
      // Build JSON
      String configuration = jsonBuilder.endObject().string()
          // https://github.com/elasticsearch/elasticsearch/issues/2897
View Full Code Here

    private void testRawField(XContentType type) throws IOException {
        XContentBuilder builder = XContentFactory.contentBuilder(type);
        builder.startObject();
        builder.field("field1", "value1");
        builder.rawField("_source", XContentFactory.contentBuilder(type).startObject().field("s_field", "s_value").endObject().bytes());
        builder.field("field2", "value2");
        builder.rawField("payload_i", new BytesArray(Long.toString(1)));
        builder.field("field3", "value3");
        builder.rawField("payload_d", new BytesArray(Double.toString(1.1)));
        builder.field("field4", "value4");
View Full Code Here

        XContentBuilder builder = XContentFactory.contentBuilder(type);
        builder.startObject();
        builder.field("field1", "value1");
        builder.rawField("_source", XContentFactory.contentBuilder(type).startObject().field("s_field", "s_value").endObject().bytes());
        builder.field("field2", "value2");
        builder.rawField("payload_i", new BytesArray(Long.toString(1)));
        builder.field("field3", "value3");
        builder.rawField("payload_d", new BytesArray(Double.toString(1.1)));
        builder.field("field4", "value4");
        builder.rawField("payload_s", new BytesArray("test"));
        builder.field("field5", "value5");
View Full Code Here

        builder.field("field1", "value1");
        builder.rawField("_source", XContentFactory.contentBuilder(type).startObject().field("s_field", "s_value").endObject().bytes());
        builder.field("field2", "value2");
        builder.rawField("payload_i", new BytesArray(Long.toString(1)));
        builder.field("field3", "value3");
        builder.rawField("payload_d", new BytesArray(Double.toString(1.1)));
        builder.field("field4", "value4");
        builder.rawField("payload_s", new BytesArray("test"));
        builder.field("field5", "value5");
        builder.endObject();
View Full Code Here

        builder.field("field2", "value2");
        builder.rawField("payload_i", new BytesArray(Long.toString(1)));
        builder.field("field3", "value3");
        builder.rawField("payload_d", new BytesArray(Double.toString(1.1)));
        builder.field("field4", "value4");
        builder.rawField("payload_s", new BytesArray("test"));
        builder.field("field5", "value5");
        builder.endObject();

        XContentParser parser = XContentFactory.xContent(type).createParser(builder.bytes());
        assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
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.