Package org.elasticsearch.common.xcontent

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


            out.endArray();
        }

        MediaEntryModule mediaEntryModule = (MediaEntryModule) message.getModule(MediaEntryModule.URI);
        if (mediaEntryModule != null) {
            out.startArray(Rss.MEDIAS);
            for (MediaContent mediaContent : mediaEntryModule.getMediaContents()) {
                out.startObject();
                addFieldIfNotNull(out, Rss.Medias.TYPE, mediaContent.getType());

                if (mediaContent.getReference() != null) {
View Full Code Here


     */
    private XContentBuilder buildResponse(BulkResponse response) throws IOException {
        XContentBuilder builder = jsonBuilder();
        builder.startObject();
        builder.field(Fields.TOOK, response.getTookInMillis());
        builder.startArray(Fields.ITEMS);
        for (BulkItemResponse itemResponse : response) {
            builder.startObject();
            builder.startObject(itemResponse.getOpType());
            builder.field(Fields._INDEX, itemResponse.getIndex());
            builder.field(Fields._TYPE, itemResponse.getType());
View Full Code Here

                        final Collection<Cluster> clusters = processingResult.getClusters();
                        final Map<String, Object> attributes = processingResult.getAttributes();

                        builder.startObject("carrot2");
                        if (clusters != null && clusters.size() > 0) {
                            builder.startArray("clusters");
                            //displayClusters

                            //limit cluster
                            int return_cluster=0;
                            for (final Cluster cluster : clusters) {
View Full Code Here

                                List<Document> docs = cluster.getAllDocuments();
                                int return_size=0;
                                if (docs != null && docs.size() > 0) {
                                    builder.field("size",docs.size());
                                    builder.field("name",cluster.getLabel());
                                    builder.startArray("documents");
                                    for (Document document : docs) {

                                        //do not return all of the docs
                                        if(return_size>req.MaxDocPerCluster){break;}
                                        return_size+=1;
View Full Code Here

                                    builder.endArray();
                                }

                                List<String> phrases = cluster.getPhrases();
                                if (phrases != null && phrases.size() > 0) {
                                    builder.startArray("phrases");
                                    for (String str : phrases) {
                                        builder.value(str);
                                    }
                                    builder.endArray();
                                }
View Full Code Here

        if (!raw) {
            river.field("raw", raw);
        }

        if (names.length > 0) {
            river.startArray("feeds");
            for (String name : names) {
                addLocalRiver(river, name);
            }
            river.endArray();
        }
View Full Code Here

    }

    if (commentIndexingMode == CommentIndexingMode.EMBEDDED) {
      List<Map<String, Object>> comments = extractComments(documentRemote);
      if (comments != null && !comments.isEmpty()) {
        out.startArray(indexFieldForComments);
        for (Map<String, Object> comment : comments) {
          out.startObject();
          addCommonFieldsToCommentIndexedDocument(out, documentId, comment);
          out.endObject();
        }
View Full Code Here

      builder.endObject();
    }
    if (coordinatorInstance != null) {
      List<SpaceIndexingInfo> currProjectIndexingInfo = coordinatorInstance.getCurrentSpaceIndexingInfo();
      if (currProjectIndexingInfo != null) {
        builder.startArray("current_indexing");
        for (SpaceIndexingInfo pi : currProjectIndexingInfo) {
          pi.buildDocument(builder, true, false);
        }
        builder.endArray();
      }
View Full Code Here

        builder.endArray();
      }
    }
    List<String> pkeys = getAllIndexedSpaceKeys();
    if (pkeys != null) {
      builder.startArray("indexed_spaces");
      for (String spaceKey : pkeys) {
        builder.startObject();
        builder.field("space_key", spaceKey);
        SpaceIndexingInfo lastIndexing = getLastSpaceIndexingInfo(spaceKey);
        if (lastIndexing != null) {
View Full Code Here

    }

    if (commentIndexingMode == CommentIndexingMode.EMBEDDED) {
      List<Map<String, Object>> comments = extractComments(documentRemote);
      if (comments != null && !comments.isEmpty()) {
        out.startArray(indexFieldForComments);
        for (Map<String, Object> comment : comments) {
          out.startObject();
          addCommonFieldsToCommentIndexedDocument(out, documentId, comment);
          out.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.