Examples of prepareBulk()


Examples of com.dotcms.repackage.org.elasticsearch.client.Client.prepareBulk()

      Runnable indexAction=new Runnable() {
            public void run() {
                try {
                    Client client=new ESClient().getClient();
                    BulkRequestBuilder req = (bulk==null) ? client.prepareBulk() : bulk;

                    // http://jira.dotmarketing.net/browse/DOTCMS-6886
                    // check for related content to reindex
                    List<Contentlet> contentToIndex=new ArrayList<Contentlet>();
                    contentToIndex.add(content);
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.client.Client.prepareBulk()

     Runnable indexRunner = new Runnable() {
              public void run() {
                try {
                    String id=content.getIdentifier()+"_"+content.getLanguageId();
                    Client client=new ESClient().getClient();
                    BulkRequestBuilder bulk=client.prepareBulk();
                    IndiciesInfo info=APILocator.getIndiciesAPI().loadIndicies();

                    bulk.add(client.prepareDelete(info.live, "content", id));
                    if(info.reindex_live!=null)
                        bulk.add(client.prepareDelete(info.reindex_live, "content", id));
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.client.Client.prepareBulk()

          while (br.ready())
            jsons.add(br.readLine());

        if (jsons.size() > 0) {
            try {
                BulkRequestBuilder req = client.prepareBulk();
                for (String raw : jsons) {
                  int delimidx=raw.indexOf(JSON_RECORD_DELIMITER);
                  if(delimidx>0) {
                    String id = raw.substring(0, delimidx);
                    String json = raw.substring(delimidx + JSON_RECORD_DELIMITER.length(), raw.length());
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.client.Client.prepareBulk()

      List<Contentlet> cons = capi.findByStructure(struct.getInode(), APILocator.getUserAPI().getSystemUser(), false, limit, offset);
      if (cons.size() == 0) {
        break;
      }
      Client client = new ESClient().getClient();
      BulkRequestBuilder bulkRequest = client.prepareBulk();
      for (Contentlet c : cons) {

        //bulkRequest.add(client.prepareIndex(ESIndexAPI.ES_INDEX_NAME, type, c.getInode()).setSource(
        //    new ESMappingAPIImpl().toJson(c)));
View Full Code Here

Examples of com.dotcms.repackage.org.elasticsearch.client.Client.prepareBulk()

                }
          }
          else if(!remoteQ.isEmpty()) {
              wait=false;
              Client client=new ESClient().getClient();
            BulkRequestBuilder bulk=client.prepareBulk();
            final ArrayList<IndexJournal<String>> recordsToDelete=new ArrayList<IndexJournal<String>>();
            while(!remoteQ.isEmpty()) {
                  IndexJournal<String> idx = remoteQ.removeFirst();
                  writeDocumentToIndex(bulk,idx);
                    recordsToDelete.add(idx);
View Full Code Here

Examples of org.elasticsearch.client.Client.prepareBulk()

            if (r.getHits().getHits().length == 0) {
                LOG.debug("No more hits, done!");
                break;
            }

            final BulkRequestBuilder bulk = client.prepareBulk();

            for (SearchHit hit : r.getHits()) {
                processedCount++;
                try {
                    if (handleHit(hit, bulk)) {
View Full Code Here

Examples of org.elasticsearch.client.Client.prepareBulk()

        System.out.println("Indexing [" + COUNT + "] ...");
        long ITERS = COUNT / BATCH;
        long i = 1;
        int counter = 0;
        for (; i <= ITERS; i++) {
            BulkRequestBuilder request = client1.prepareBulk();
            for (int j = 0; j < BATCH; j++) {
                counter++;
                request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(counter)).source(source(Integer.toString(counter), "test" + counter)));
            }
            BulkResponse response = request.execute().actionGet();
View Full Code Here

Examples of org.elasticsearch.client.Client.prepareBulk()

            System.out.println("--> Indexing [" + COUNT + "] ...");
            long ITERS = COUNT / BATCH;
            long i = 1;
            int counter = 0;
            for (; i <= ITERS; i++) {
                BulkRequestBuilder request = client.prepareBulk();
                for (int j = 0; j < BATCH; j++) {
                    counter++;
                    request.add(Requests.indexRequest("test").type("parent").id(Integer.toString(counter))
                            .source(parentSource(Integer.toString(counter), "test" + counter)));
                    for (int k = 0; k < CHILD_COUNT; k++) {
View Full Code Here

Examples of org.elasticsearch.client.Client.prepareBulk()

        }

        Client client = nodes.length == 1 ? nodes[0].client() : nodes[1].client();

        while (true) {
            BulkRequestBuilder bulkRequest = client.prepareBulk();
            for (int i = 0; i < BATCH; i++) {
                bulkRequest.add(Requests.indexRequest("test" + ThreadLocalRandom.current().nextInt(NUMBER_OF_INDICES)).type("type").source("field", "value"));
            }
            bulkRequest.execute().actionGet();
        }
View Full Code Here

Examples of org.elasticsearch.client.Client.prepareBulk()

            System.out.println("--> Indexing [" + COUNT + "] ...");
            long ITERS = COUNT / BATCH;
            long i = 1;
            int counter = 0;
            for (; i <= ITERS; i++) {
                BulkRequestBuilder request = client.prepareBulk();
                for (int j = 0; j < BATCH; j++) {
                    counter++;
                    XContentBuilder source = jsonBuilder().startObject()
                            .field("id", Integer.valueOf(counter))
                            .field("l_value", lValues[counter % lValues.length])
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.