Package org.elasticsearch.common.xcontent

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


    expected.field("src_path", "/tmp/test");
    expected.field("host", "test@localhost");
    expected.field("headerNameTwo", "headerValueTwo");
    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
    expected.field("type", "sometype");
    expected.endObject();

    expected.endObject();

    XContentBuilder actual = fixture.getContentBuilder(event);
View Full Code Here


    headers.put("type", "sometype");
    Event event = EventBuilder.withBody(message.getBytes(charset));
    event.setHeaders(headers);

    XContentBuilder expected = jsonBuilder().startObject();
    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
View Full Code Here

    Event event = EventBuilder.withBody(message.getBytes(charset));
    event.setHeaders(headers);

    XContentBuilder expected = jsonBuilder().startObject();
    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
View Full Code Here

    event.setHeaders(headers);

    XContentBuilder expected = jsonBuilder().startObject();
    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
    expected.field("timestamp", String.valueOf(timestamp));
View Full Code Here

    XContentBuilder expected = jsonBuilder().startObject();
    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
    expected.field("timestamp", String.valueOf(timestamp));
    expected.field("src_path", "/tmp/test");
View Full Code Here

    XContentBuilder expected = jsonBuilder().startObject();
    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
    expected.field("timestamp", String.valueOf(timestamp));
    expected.field("src_path", "/tmp/test");
    expected.field("host", "test@localhost");
View Full Code Here

    expected.field("@message", new String(message.getBytes(), charset));
    expected.field("@timestamp", new Date(timestamp));
    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
    expected.field("timestamp", String.valueOf(timestamp));
    expected.field("src_path", "/tmp/test");
    expected.field("host", "test@localhost");
    expected.field("headerNameTwo", "headerValueTwo");
View Full Code Here

    expected.field("@source", "flume_tail_src");
    expected.field("@type", "sometype");
    expected.field("@source_host", "test@localhost");
    expected.field("@source_path", "/tmp/test");
    expected.startObject("@fields");
    expected.field("timestamp", String.valueOf(timestamp));
    expected.field("src_path", "/tmp/test");
    expected.field("host", "test@localhost");
    expected.field("headerNameTwo", "headerValueTwo");
    expected.field("source", "flume_tail_src");
    expected.field("headerNameOne", "headerValueOne");
View Full Code Here

        XContentBuilder json = XContentFactory.jsonBuilder().startObject()
                .field("field", "value" + ThreadLocalRandom.current().nextInt());

        int fields = Math.abs(ThreadLocalRandom.current().nextInt()) % numberOfFields;
        for (int i = 0; i < fields; i++) {
            json.field("num_" + i, ThreadLocalRandom.current().nextDouble());
            int tokens = ThreadLocalRandom.current().nextInt() % textTokens;
            sb.setLength(0);
            for (int j = 0; j < tokens; j++) {
                sb.append(UUID.randomBase64UUID()).append(' ');
            }
View Full Code Here

            int tokens = ThreadLocalRandom.current().nextInt() % textTokens;
            sb.setLength(0);
            for (int j = 0; j < tokens; j++) {
                sb.append(UUID.randomBase64UUID()).append(' ');
            }
            json.field("text_" + i, sb.toString());
        }

        json.endObject();

        String id = Long.toString(idCounter.incrementAndGet());
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.