org.elasticsearch.client.Client.multiGet()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中org.elasticsearch.client.Client.multiGet()方法的一些代码示例,展示了Client.multiGet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.multiGet()方法的具体详情如下:
包路径:org.elasticsearch.client.Client
类名称:Client
方法名:multiGet

Client.multiGet介绍

[英]Multi get documents.
[中]多获取文档。

代码示例

代码示例来源:origin: floragunncom/search-guard

client.multiGet(mget, new ActionListener<MultiGetResponse>() {
  @Override
  public void onResponse(MultiGetResponse response) {

代码示例来源:origin: floragunncom/search-guard

mget.realtime(true);
client.multiGet(mget, new ActionListener<MultiGetResponse>() {
  @Override
  public void onResponse(MultiGetResponse response) {

代码示例来源:origin: javanna/elasticshell

@Override
  protected ActionFuture<MultiGetResponse> doExecute(MultiGetRequest request) {
    return client.multiGet(request);
  }
}

代码示例来源:origin: rmagen/elastic-gremlin

@Override
public Iterator<Edge> edges(Object[] ids) {
  MultiGetRequest request = new MultiGetRequest().refresh(refresh);
  for (Object id : ids) request.add(indexName, null, id.toString());
  MultiGetResponse responses = client.multiGet(request).actionGet();
  ArrayList<Edge> elements = new ArrayList<>(ids.length);
  for (MultiGetItemResponse getResponse : responses) {
    GetResponse response = getResponse.getResponse();
    if (!response.isExists()) throw Graph.Exceptions.elementNotFound(Edge.class, response.getId());
    elements.add(createEdge(response));
  }
  return elements.iterator();
}

代码示例来源:origin: com.floragunn/search-guard-6

mget.realtime(true);
client.multiGet(mget, new ActionListener<MultiGetResponse>() {
  @Override
  public void onResponse(MultiGetResponse response) {

代码示例来源:origin: com.floragunn/search-guard-6

client.multiGet(mget, new ActionListener<MultiGetResponse>() {
  @Override
  public void onResponse(MultiGetResponse response) {

代码示例来源:origin: rmagen/elastic-gremlin

public void execute() {
    if (executed) return;

    timing.start("lazyMultiGet");
    MultiGetResponse multiGetItemResponses = client.multiGet(multiGetRequest).actionGet();
    timing.stop("lazyMultiGet");

    multiGetItemResponses.forEach(response -> {
      if (response.isFailed() || !response.getResponse().isExists()) {
        System.out.println(response.getFailure().getMessage());
        return;
      }
      List<BaseVertex> vertices = idToVertices.get(response.getId());
      if (vertices == null) return;
      vertices.forEach(vertex -> vertex.applyLazyFields(response));
    });

    executed = true;
    multiGetRequest = null;
    idToVertices = null;
    client = null;
  }
}

代码示例来源:origin: harbby/presto-connectors

@Override
  public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
    MultiGetRequest multiGetRequest = new MultiGetRequest();
    multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh()));
    multiGetRequest.preference(request.param("preference"));
    multiGetRequest.realtime(request.paramAsBoolean("realtime", null));
    multiGetRequest.ignoreErrorsOnGeneratedFields(request.paramAsBoolean("ignore_errors_on_generated_fields", false));

    String[] sFields = null;
    String sField = request.param("fields");
    if (sField != null) {
      sFields = Strings.splitStringByCommaToArray(sField);
    }

    FetchSourceContext defaultFetchSource = FetchSourceContext.parseFromRestRequest(request);
    multiGetRequest.add(request.param("index"), request.param("type"), sFields, defaultFetchSource, request.param("routing"), RestActions.getRestContent(request), allowExplicitIndex);

    client.multiGet(multiGetRequest, new RestToXContentListener<MultiGetResponse>(channel));
  }
}

相关文章