Examples of numberOfActions()


Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

      // anything left after loop? index that too
      if (brb.numberOfActions() > 0) {
        resp = brb.execute().actionGet();
        logger.info("rebuildIndex(): indexed {}, hasFailures: {}",
            brb.numberOfActions(), resp.hasFailures());
      }

      // switch to alias NEW_INDEX -> ALIAS, OLD_INDEX -> X, deleting the old index
      switchIndexToAlias(oldName, newName, appid, true);
    } catch (Exception e) {
View Full Code Here

Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

                builder.add(
                        client.prepareIndex(INDEX_NAME, TYPE_NAME, String.valueOf(i))
                        .setSource(fieldValues)
                );

                if (builder.numberOfActions() >= 1000) {
                    builder.get();
                    builder = client.prepareBulk();
                }
            }
            if (builder.numberOfActions() > 0) {
View Full Code Here

Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

            builder.add(
                    client.prepareIndex(INDEX_NAME, TYPE_NAME, String.valueOf(i))
                            .setSource(sourceBuilder)
            );

            if (builder.numberOfActions() >= 1000) {
                builder.get();
                builder = client.prepareBulk();
            }

            if (i % PRINT == 0) {
View Full Code Here

Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

                long took = System.currentTimeMillis() - time;
                time = System.currentTimeMillis();
                System.out.println("Indexed " + i +  " docs, in " + TimeValue.timeValueMillis(took));
            }
        }
        if (builder.numberOfActions() > 0) {
            builder.get();
        }


View Full Code Here

Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

                if (builder.numberOfActions() >= 1000) {
                    builder.get();
                    builder = client.prepareBulk();
                }
            }
            if (builder.numberOfActions() > 0) {
                builder.get();
            }
        } catch (IndexAlreadyExistsException e) {
            System.out.println("--> Index already exists, ignoring indexing phase, waiting for green");
            ClusterHealthResponse clusterHealthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().setTimeout("10m").execute().actionGet();
View Full Code Here

Examples of org.elasticsearch.action.bulk.BulkRequestBuilder.numberOfActions()

            brb.add(getClient().prepareIndex(appid, obj.getType(), obj.getId()).
                setSource(Utils.getAnnotatedFields(obj)));
            pager.setLastKey(obj.getId());
          }
          // bulk index 1000 objects
          if (brb.numberOfActions() > 100) {
            resp = brb.execute().actionGet();
            logger.info("rebuildIndex(): indexed {}, hasFailures: {}",
                brb.numberOfActions(), resp.hasFailures());
          }
        } while(!(list = dao.readPage(appid, pager)).isEmpty());
View Full Code Here

Examples of org.elasticsearch.client.action.bulk.BulkRequestBuilder.numberOfActions()

                            continue;
                        }

                        deliveryTags.add(task.getEnvelope().getDeliveryTag());

                        if (bulkRequestBuilder.numberOfActions() < bulkSize) {
                            // try and spin some more of those without timeout, so we have a bigger bulk (bounded by the bulk size)
                            try {
                                while ((task = consumer.nextDelivery(bulkTimeout.millis())) != null) {
                                    try {
                                        bulkRequestBuilder.add(task.getBody(), 0, task.getBody().length, false);
View Full Code Here

Examples of org.elasticsearch.client.action.bulk.BulkRequestBuilder.numberOfActions()

                                        } catch (IOException e1) {
                                            logger.warn("failed to ack on failure [{}]", e1, task.getEnvelope().getDeliveryTag());
                                        }
                                    }
                                    deliveryTags.add(task.getEnvelope().getDeliveryTag());
                                    if (bulkRequestBuilder.numberOfActions() >= bulkSize) {
                                        break;
                                    }
                                }
                            } catch (InterruptedException e) {
                                if (closed) {
View Full Code Here

Examples of org.elasticsearch.client.action.bulk.BulkRequestBuilder.numberOfActions()

                                }
                            }
                        }

                        if (logger.isTraceEnabled()) {
                            logger.trace("executing bulk with [{}] actions", bulkRequestBuilder.numberOfActions());
                        }

                        if (ordered) {
                            try {
                                BulkResponse response = bulkRequestBuilder.execute().actionGet();
View Full Code Here

Examples of org.elasticsearch.client.action.bulk.BulkRequestBuilder.numberOfActions()

                        lineSeq = processLine(s, bulk);
                        if (lineSeq != null) {
                            lastSeq = lineSeq;
                        }

                        if (bulk.numberOfActions() >= bulkSize) {
                            break;
                        }
                    }
                } catch (InterruptedException e) {
                    if (closed) {
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.