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

x33g5p2x  于2022-01-20 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(148)

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

IndicesAdminClient.getIndex介绍

[英]Get index metadata for particular indices.
[中]获取特定索引的索引元数据。

代码示例

代码示例来源:origin: prestodb/presto

private String[] getIndices(TransportClient client, GetIndexRequest request)
{
  try {
    return retry()
        .maxAttempts(maxAttempts)
        .exponentialBackoff(maxRetryTime)
        .run("getIndices", () -> client.admin()
            .indices()
            .getIndex(request)
            .actionGet(requestTimeout.toMillis())
            .getIndices());
  }
  catch (Exception e) {
    throw new RuntimeException(e);
  }
}

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

sgIndex = tc.admin().indices().getIndex(new GetIndexRequest().indices(index).addFeatures(Feature.MAPPINGS)).actionGet();
} catch (IndexNotFoundException e1) {

代码示例来源:origin: apache/usergrid

ActionFuture<GetIndexResponse> responseFuture = provider.getClient().admin().indices().getIndex(new GetIndexRequest());
Observable
  .from(responseFuture)

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
  final GetIndexRequest getIndexRequest = new GetIndexRequest();
  getIndexRequest.indices(indices);
  getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
  getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
  getIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexRequest.masterNodeTimeout()));
  getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
  getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
  return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel));
}

代码示例来源:origin: org.elasticsearch/elasticsearch

getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: Yirendai/cicada

private List<String> getAllIndice() {
  final List<String> indice = new LinkedList<String>();
  final GetIndexResponse resp = client.admin().indices().getIndex(new GetIndexRequest()).actionGet();

  for (final String indexName : resp.indices()) {
   if (indexName.startsWith(props.getEsSpanIndexPrefix()) //
     || indexName.startsWith(props.getEsAnnotationIndexPrefix())) {
    indice.add(indexName);
   }
  }

  return indice;
 }
}

代码示例来源:origin: ConsenSys/IPFS-Store

@Override
public Result check() {
  log.debug("check elastic search health ...");
  try {
    // NEED ELASTIC LICENSES TO REQUEST CLUSTER_HEATLH
    // final ClusterHealthStatus status =
    // client.admin().cluster().prepareHealth().get().getStatus();
    // log.debug("status={}", status.toString());
    //
    // if (status == ClusterHealthStatus.RED) {
    // return Result.unhealthy("Last status: %s", status.name());
    // } else {
    // return Result.healthy("Last status: %s", status.name());
    // }
    client.admin().indices().getIndex(new GetIndexRequest()).actionGet().getIndices();
    log.debug("check elastic search health : OK");
    return Result.healthy("ElasticSearch is OK");
  } catch (Exception e) {
    log.error("Error whilst checking ElasticSearch health", e);
    return Result.unhealthy(e);
  }
}

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

@Override
public ElasticsearchTable getTable(SchemaTableName tableName)
{
  String indexWildcard = tableName.getTableName();
  GetIndexRequest getIndexRequest = createGetIndexRequest(indexWildcard);
  Thread.currentThread().setName("getTable_001"); //----es scher error --
  GetIndexResponse response = client.admin().indices()
      .getIndex(getIndexRequest).actionGet();
  if (response.getIndices() == null || response.getIndices().length == 0) {
    return null;
  }
  //TODO: es中运行index名访问时可以使用*进行匹配,所以可能会返回多个index的mapping, 因此下面需要进行mapping merge  test table = test1"*"
  ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.getMappings();
  List<IndexResolution> resolutions;
  if (mappings.size() > 0) {
    resolutions = new ArrayList<>(mappings.size());
    for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings : mappings) {
      resolutions.add(buildGetIndexResult(indexMappings.key, indexMappings.value));
    }
  }
  else {
    resolutions = emptyList();
  }
  IndexResolution indexWithMerged = merge(resolutions, indexWildcard);
  return new ElasticsearchTable(typeManager, tableName.getSchemaName(), tableName.getTableName(), indexWithMerged.get());
}

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

sgIndex = tc.admin().indices().getIndex(new GetIndexRequest().indices(index).addFeatures(Feature.MAPPINGS)).actionGet();
} catch (IndexNotFoundException e1) {

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

@Override
public ElasticsearchTable getTable(SchemaTableName tableName)
{
  String indexWildcard = tableName.getTableName();
  GetIndexRequest getIndexRequest = createGetIndexRequest(indexWildcard);
  //----es scher error --
  Thread.currentThread().setName("getTable_001");
  GetIndexResponse response = client.admin().indices()
      .getIndex(getIndexRequest).actionGet();
  if (response.getIndices() == null || response.getIndices().length == 0) {
    return null;
  }
  //TODO: es中运行index名访问时可以使用*进行匹配,所以可能会返回多个index的mapping, 因此下面需要进行mapping merge  test table = test1"*"
  ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.getMappings();
  List<IndexResolution> resolutions;
  if (mappings.size() > 0) {
    resolutions = new ArrayList<>(mappings.size());
    for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings : mappings) {
      resolutions.add(buildGetIndexResult(indexMappings.key, indexMappings.value));
    }
  }
  else {
    resolutions = emptyList();
  }
  IndexResolution indexWithMerged = merge(resolutions, indexWildcard);
  return new ElasticsearchTable(typeManager, tableName.getSchemaName(), tableName.getTableName(), indexWithMerged.get());
}

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

@Override
public ElasticsearchTable getTable(SchemaTableName tableName)
{
  String indexWildcard = tableName.getTableName();
  GetIndexRequest getIndexRequest = createGetIndexRequest(indexWildcard);
  Thread.currentThread().setName("getTable_001"); //----es scher error --
  GetIndexResponse response = client.admin().indices()
      .getIndex(getIndexRequest).actionGet();
  if (response.getIndices() == null || response.getIndices().length == 0) {
    return null;
  }
  //TODO: es中运行index名访问时可以使用*进行匹配,所以可能会返回多个index的mapping, 因此下面需要进行mapping merge  test table = test1"*"
  ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.getMappings();
  List<IndexResolution> resolutions;
  if (mappings.size() > 0) {
    resolutions = new ArrayList<>(mappings.size());
    for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings : mappings) {
      resolutions.add(buildGetIndexResult(indexMappings.key, indexMappings.value));
    }
  }
  else {
    resolutions = emptyList();
  }
  IndexResolution indexWithMerged = merge(resolutions, indexWildcard);
  return new ElasticsearchTable(typeManager, tableName.getSchemaName(), tableName.getTableName(), indexWithMerged.get());
}

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

getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
  final GetIndexRequest getIndexRequest = new GetIndexRequest();
  getIndexRequest.indices(indices);
  getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
  getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
  getIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexRequest.masterNodeTimeout()));
  getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
  getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
  return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
  String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
  final GetIndexRequest getIndexRequest = new GetIndexRequest();
  getIndexRequest.indices(indices);
  getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
  getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
  getIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexRequest.masterNodeTimeout()));
  getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
  getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
  return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel));
}

代码示例来源:origin: apache/servicemix-bundles

getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: apache/servicemix-bundles

getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
final boolean defaults = request.paramAsBoolean("include_defaults", false);
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

代码示例来源:origin: apache/servicemix-bundles

return channel -> client.admin().indices().getIndex(getIndexRequest, new RestBuilderListener<GetIndexResponse>(channel) {

相关文章

微信公众号

最新文章

更多

IndicesAdminClient类方法