org.elasticsearch.cluster.metadata.MetaData.aliases()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(135)

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

MetaData.aliases介绍

暂无

代码示例

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

private List<String> getOnlyAliases(final List<String> indices) {
  final List<String> result = new ArrayList<String>();
  final ImmutableOpenMap<String, ImmutableOpenMap<String, AliasMetaData>> aliases = clusterService.state().metaData().aliases();
  for (int i = 0; i < indices.size(); i++) {
    final String index = indices.get(i);
    final ImmutableOpenMap<String, AliasMetaData> indexAliases = aliases.get(index);
    if (indexAliases == null || indexAliases.size() == 0) {
      continue;
    } else {
      result.add(index);
    }
  }
  return result;
}

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

private List<String> resolveAliases(final List<String> indices) {
  final List<String> result = new ArrayList<String>();
  final ImmutableOpenMap<String, ImmutableOpenMap<String, AliasMetaData>> aliases = clusterService.state().metaData().aliases();
  for (int i = 0; i < indices.size(); i++) {
    final String index = indices.get(i);
    final ImmutableOpenMap<String, AliasMetaData> indexAliases = aliases.get(index);
    if (indexAliases == null || indexAliases.size() == 0) {
      result.add(index);
      log.trace("{} is an concrete index", index);
      continue;
    }
    log.trace("{} is an alias and points to -> {}", index, indexAliases.keys());
    for (final Iterator<org.elasticsearch.common.hppc.cursors.ObjectObjectCursor<String, AliasMetaData>> iterator = indexAliases
        .iterator(); iterator.hasNext();) {
      final org.elasticsearch.common.hppc.cursors.ObjectObjectCursor<String, AliasMetaData> entry = iterator.next();
      result.add(entry.key);
    }
  }
  return result;
}

代码示例来源:origin: karussell/elasticsearch-rollindex

public ImmutableOpenMap<String, AliasMetaData> getAliases(String alias) {
  ImmutableOpenMap<String, AliasMetaData> md = client.admin().cluster().state(new ClusterStateRequest()).
      actionGet().getState().getMetaData().aliases().get(alias);
  if (md == null)
    return ImmutableOpenMap.of();
  return md;
}
private static Comparator<Long> reverseSorter = new Comparator<Long>() {

相关文章