Package org.elasticsearch.action.get.MultiGetRequest

Examples of org.elasticsearch.action.get.MultiGetRequest.Item


    // Action
    Iterator<MultiGetItemResponse> actual = entityDao.getNodeItems(Arrays.asList(way));

    // Assert
    Item item = new Item(INDEX_NAME, ESEntityType.NODE.getIndiceName(), "1").fields("shape");
    verify(multiGetRequestBuilderMocked).add(argThat(new ItemMatcher(item)));
    verify(multiGetRequestBuilderMocked, times(1)).execute();
    Assert.assertSame(iteratorMocked, actual);
  }
View Full Code Here


    // Action
    MultiGetRequestBuilder actual = entityDao.buildMultiGetRequest(ESNode.class, 1, 2);

    // Assert
    Item item1 = new Item(INDEX_NAME, ESEntityType.NODE.getIndiceName(), "1")
        .fields("centroid", "lengthKm", "areaKm2", "shape", "tags");
    Item item2 = new Item(INDEX_NAME, ESEntityType.NODE.getIndiceName(), "2")
        .fields("centroid", "lengthKm", "areaKm2", "shape", "tags");
    verify(multiGetRequestBuilderMocked).add(argThat(new ItemMatcher(item1)));
    verify(multiGetRequestBuilderMocked).add(argThat(new ItemMatcher(item2)));
    Assert.assertSame(multiGetRequestBuilderMocked, actual);
  }
View Full Code Here

    @Override
    public boolean matches(Object item) {
      if (expected == item) return true;
      if (item == null) return false;
      if (expected.getClass() != item.getClass()) return false;
      Item other = (Item) item;
      return expected.index().equals(other.index())
          && expected.type().equals(other.type())
          && expected.id().equals(other.id())
          && Arrays.equals(expected.fields(), other.fields());
    }
View Full Code Here

  protected Iterator<MultiGetItemResponse> getNodeItems(List<Way> ways) {
    MultiGetRequestBuilder request = client.prepareMultiGet();
    for (Way way : ways) {
      for (WayNode wayNode : way.getWayNodes()) {
        request.add(new Item(indexName, ESEntityType.NODE.getIndiceName(),
            String.valueOf(wayNode.getNodeId())).fields("shape"));
      }
    }
    MultiGetResponse responses = request.execute().actionGet();
    Iterator<MultiGetItemResponse> iterator = responses.iterator();
View Full Code Here

  protected <T extends ESEntity> MultiGetRequestBuilder buildMultiGetRequest(Class<T> entityClass, long... osmIds) {
    ESEntityType type = ESEntityType.valueOf(entityClass);
    MultiGetRequestBuilder request = client.prepareMultiGet();
    for (long osmId : osmIds) {
      request.add(new Item(indexName, type.getIndiceName(), String.valueOf(osmId))
          .fields("centroid", "lengthKm", "areaKm2", "shape", "tags"));
    }
    return request;
  }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.get.MultiGetRequest.Item

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.