Package org.elasticsearch.action.bulk

Examples of org.elasticsearch.action.bulk.BulkResponse


      String jsonString = mapper.writeValueAsString(beer);
      irq.source(jsonString);
      brb.add(irq);
    }

    BulkResponse br = brb.execute().actionGet();
    Assert.assertFalse(br.hasFailures());

    node.client().admin().indices().prepareRefresh().execute().actionGet();
  }
View Full Code Here


    for (int i = 0; i < 1000; i++) {
      DeleteRequest dr = new DeleteRequest("meal", "beer", "beer_" + i);
      brb.add(dr);
    }

    BulkResponse br = brb.execute().actionGet();
    Assert.assertFalse(br.hasFailures());
  }
View Full Code Here

      Beer beer = BeerHelper.generate();
      IndexRequest irq =  null;
     
      // TODO Add the beer to meal index, type beer and set id = "beer_"+i
    }
    BulkResponse br = null;
   
    // TODO Execute the bulk

    Assert.assertFalse(br.hasFailures());

    // TODO and now remove all beers using bulk

    // We will check that all beers were found before removal
    for (BulkItemResponse bulkItemResponse : br) {
View Full Code Here

      String jsonString = mapper.writeValueAsString(beer);
      irq.source(jsonString);
      brb.add(irq);
    }

    BulkResponse br = brb.execute().actionGet();
    Assert.assertFalse(br.hasFailures());
  }
View Full Code Here

    for (int i = 0; i < 1000; i++) {
      DeleteRequest dr = new DeleteRequest("meal", "beer", "beer_" + i);
      brb.add(dr);
    }

    BulkResponse br = brb.execute().actionGet();
    Assert.assertFalse(br.hasFailures());
  }
View Full Code Here

            } 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()) {
//                        logger.info("Error:" + br.failureMessage());
                        list.add(br.itemId());
                    }
                }
View Full Code Here

                F.Promise<BulkResponse> promise = IndexService.indexBulkAsync(
                        index1Type1.getIndexPath(),
                        Arrays.asList(index1Type1, index1Type1Bis, index1Type1Ter)
                );

                BulkResponse response = promise.get(10L, TimeUnit.SECONDS);
                assertThat(response.getItems().length).isEqualTo(3);
            }
        });
    }
View Full Code Here

            String json = new Gson().toJson(metadata);

            BulkRequestBuilder bulkRequest = client.prepareBulk();
            bulkRequest.add(client.prepareIndex(index, "metadata", metadata.name).setSource(json));

            BulkResponse bulkResponse = bulkRequest.execute().actionGet();

            if(bulkResponse.hasFailures()) {
                Crawler.logger.error("Elastic Search Failure: " + bulkResponse.buildFailureMessage());
            }

        } else {
            unhandled(message);
        }
View Full Code Here

        Crawler.logger.debug("Adding item #" + itemCounter + ": " + index + "/" + type + "/" + resourceId);
    }

    public void onEnd() {
        BulkResponse bulkResponse = bulkRequest.execute().actionGet();

        if(bulkResponse.hasFailures()) {
            Crawler.logger.error("Elasticsearch Failure: " + bulkResponse.buildFailureMessage());
        } else {
            Crawler.logger.info("***** " + itemCounter + " items saved in: " + index + "/" + type + "/" + id + "-[..] *****");
        }
    }
View Full Code Here

    return client.prepareBulk();
  }

  @Override
  public void executeESBulkRequest(BulkRequestBuilder esBulk) throws Exception {
    BulkResponse response = esBulk.execute().actionGet();
    if (response.hasFailures()) {
      throw new ElasticSearchException("Failed to execute ES index bulk update: " + response.buildFailureMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.bulk.BulkResponse

Copyright © 2018 www.massapicom. 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.