Examples of numberOfActions()


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

                completeListener = new OperationBatch(0, toIndex, toDelete);
                operationBatchList.add(completeListener);
                try {
                    bulkRequestBuilder.execute().addListener(completeListener);
                } catch (Exception e) {
                    throw new IndexException("Failed to index/delete " + bulkRequestBuilder.numberOfActions(), e);
                }
            }
        }

        return completeListener;
View Full Code Here

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

                brb.add(indexReq);
            } catch (Exception ex) {
                logger.warn("Cannot add object:" + hit + " to bulkIndexing action." + ex.getMessage());
            }
        }
        if (brb.numberOfActions() > 0) {
            BulkResponse rsp = brb.execute().actionGet();
            if (rsp.hasFailures()) {
                List<Integer> list = new ArrayList<Integer>(rsp.getItems().length);
                for (BulkItemResponse br : rsp.getItems()) {
                    if (br.isFailed())
View Full Code Here

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

                brb.add(indexReq);
            } catch (IOException ex) {
                logger.warn("Cannot add object:" + o + " to bulkIndexing action." + ex.getMessage());
            }
        }
        if (brb.numberOfActions() > 0) {
            BulkResponse rsp = brb.execute().actionGet();
            if (rsp.hasFailures()) {
                List<Integer> list = new ArrayList<Integer>(rsp.items().length);
                for (BulkItemResponse br : rsp.items()) {                   
                    if(br.isFailed()) {
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.action.bulk.BulkRequestBuilder.numberOfActions()

          }
          // 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());
      }

      // anything left after loop? index that too
View Full Code Here

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

          }
        } while(!(list = dao.readPage(appid, pager)).isEmpty());
      }

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

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
      getClient().admin().indices().prepareAliases().
          addAlias(newName, appid).
View Full Code Here

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

                            BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
                            logger.info("{} objects indexed with ", count, bulkResponse.hasFailures()? "errors" : "success");
                        }                       
                    }
                   
                    if(bulkRequest.numberOfActions() > 0){
                        BulkResponse bulkResponse = bulkRequest.setRefresh(true).execute().actionGet(bulkTimeout);
                        logger.info("{} objects indexed with ", count, bulkResponse.hasFailures()? "errors" : "success");
                    }

                } catch (Exception e) {
View Full Code Here

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

    BulkRequestBuilder bulkRequestBuilder = searchClient.prepareBulk();

    long normTime = processActionsIntoQueries(bulkRequestBuilder, actions);

    if (bulkRequestBuilder.numberOfActions() > 0) {
      // execute the request
      long indexTime = System.currentTimeMillis();
      BulkResponse response = bulkRequestBuilder.setRefresh(false).get();

      indexTime = System.currentTimeMillis() - indexTime;
View Full Code Here

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

      if (refreshRequired) {
        refreshTime = this.refreshRequiredIndex(indices);
      }

      LOGGER.debug("-- submitted {} items with {}ms in normalization, {}ms indexing and {}ms refresh({}). Total: {}ms",
        bulkRequestBuilder.numberOfActions(), normTime, indexTime, refreshTime, indices, (normTime + indexTime + refreshTime));

      if (response.hasFailures()) {
        throw new IllegalStateException("Errors while indexing stack: " + response.buildFailureMessage());
      }
    }
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.