コード例 #1
0
  public void testMultiPercolate() {
    String multiPercolateShardAction = MultiPercolateAction.NAME + "[shard][s]";
    interceptTransportActions(multiPercolateShardAction);

    client().prepareIndex("test-get", "type", "1").setSource("field", "value").get();

    MultiPercolateRequest multiPercolateRequest = new MultiPercolateRequest();
    List<String> indices = new ArrayList<>();
    int numRequests = iterations(1, 30);
    for (int i = 0; i < numRequests; i++) {
      String[] indicesOrAliases = randomIndicesOrAliases();
      Collections.addAll(indices, indicesOrAliases);
      PercolateRequest percolateRequest =
          new PercolateRequest().indices(indicesOrAliases).documentType("type");
      if (randomBoolean()) {
        percolateRequest.getRequest(new GetRequest("test-get", "type", "1"));
      } else {
        percolateRequest.source("\"field\":\"value\"");
      }
      multiPercolateRequest.add(percolateRequest);
    }

    internalCluster().clientNodeClient().multiPercolate(multiPercolateRequest).actionGet();

    clearInterceptedActions();
    assertIndicesSubset(indices, multiPercolateShardAction);
  }
コード例 #2
0
 synchronized void interceptTransportActions(String... actions) {
   Collections.addAll(this.actions, actions);
 }