Package org.elasticsearch.common.xcontent

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


                            builder.field("country_code", status.getPlace().getCountryCode());
                            builder.field("url", status.getPlace().getURL());
                            builder.endObject();
                        }
                        if (status.getURLEntities() != null) {
                            builder.startArray("link");
                            for (URLEntity url : status.getURLEntities()) {
                                if (url != null) {
                                    builder.startObject();
                                    if (url.getURL() != null) {
                                        builder.field("url", url.getURL());
View Full Code Here


                    builder.field("l_value", lValue);
                    builder.field("s_value_dv", sValue);
                    builder.field("l_value_dv", lValue);

                    for (String field : new String[] {"sm_value", "sm_value_dv"}) {
                        builder.startArray(field);
                        for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
                            builder.value(sValues[ThreadLocalRandom.current().nextInt(sValues.length)]);
                        }
                        builder.endArray();
                    }
View Full Code Here

                        }
                        builder.endArray();
                    }

                    for (String field : new String[] {"lm_value", "lm_value_dv"}) {
                        builder.startArray(field);
                        for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
                            builder.value(lValues[ThreadLocalRandom.current().nextInt(sValues.length)]);
                        }
                        builder.endArray();
                    }
View Full Code Here

                    builder.field("l_value", lValue);
                    builder.field("s_value_dv", sValue);
                    builder.field("l_value_dv", lValue);

                    for (String field : new String[] {"sm_value", "sm_value_dv"}) {
                        builder.startArray(field);
                        for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
                            builder.value(sValues[ThreadLocalRandom.current().nextInt(sValues.length)]);
                        }
                        builder.endArray();
                    }
View Full Code Here

                        }
                        builder.endArray();
                    }

                    for (String field : new String[] {"lm_value", "lm_value_dv"}) {
                        builder.startArray(field);
                        for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
                            builder.value(ThreadLocalRandom.current().nextInt(NUMBER_OF_TERMS));
                        }
                        builder.endArray();
                    }
View Full Code Here

                    final String sValue = sValues[counter % sValues.length];
                    builder.field("s_value", sValue);
                    builder.field("s_value_dv", sValue);

                    for (String field : new String[] {"sm_value", "sm_value_dv"}) {
                        builder.startArray(field);
                        for (int k = 0; k < NUMBER_OF_MULTI_VALUE_TERMS; k++) {
                            builder.value(sValues[ThreadLocalRandom.current().nextInt(sValues.length)]);
                        }
                        builder.endArray();
                    }
View Full Code Here

    }

    private String ItemToJSON(Item item) throws IOException {
        XContentBuilder builder = XContentFactory.jsonBuilder();
        builder.startObject();
        builder.startArray("docs");
        item.toXContent(builder, ToXContent.EMPTY_PARAMS);
        builder.endArray();
        builder.endObject();
        return XContentHelper.convertToJson(builder.bytes(), false);
    }
View Full Code Here

                copyToStringFromClasspath("/org/elasticsearch/index/query/items.json"));

        // create builder from items
        XContentBuilder builder = XContentFactory.jsonBuilder();
        builder.startObject();
        builder.startArray("docs");
        for (MultiGetRequest.Item item : itemsFromJSON) {
            MoreLikeThisQueryBuilder.Item itemForBuilder = (MoreLikeThisQueryBuilder.Item) new MoreLikeThisQueryBuilder.Item(
                    item.index(), item.type(), item.id())
                    .fetchSourceContext(item.fetchSourceContext())
                    .fields(item.fields());
View Full Code Here

                values[upto++] = bb.byteValue();
            }

            XContentBuilder doc = XContentFactory.jsonBuilder().startObject();
            for (String fieldName : Arrays.asList("byte", "short", "integer", "long")) {
                doc = doc.startArray(fieldName);
                for (int j = 0; j < numValues; ++j) {
                    doc = doc.value(values[j]);
                }
                doc = doc.endArray();
            }
View Full Code Here

    public static RestResponse buildXContentBuilder(Table table, RestChannel channel) throws Exception {
        RestRequest request = channel.request();
        XContentBuilder builder = channel.newBuilder();
        List<DisplayHeader> displayHeaders = buildDisplayHeaders(table, request);

        builder.startArray();
        for (int row = 0; row < table.getRows().size(); row++) {
            builder.startObject();
            for (DisplayHeader header : displayHeaders) {
                builder.field(header.display, renderValue(request, table.getAsMap().get(header.name).get(row).value));
            }
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.