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

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

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

MetaData.indices介绍

暂无

代码示例

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

private static boolean clusterHas5xIndices(ClusterState state) {
    final Iterator<IndexMetaData> indices = state.metaData().indices().valuesIt();
    for(;indices.hasNext();) {
      final IndexMetaData indexMetaData = indices.next();
      if(indexMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
        return true;
      }
    }
    return false;
  }
}

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

public ImmutableOpenMap<String, IndexMetaData> getIndices() {
  return indices();
}

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

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

/**
 * Returns the indices created in this event
 */
public List<String> indicesCreated() {
  if (!metaDataChanged()) {
    return Collections.emptyList();
  }
  List<String> created = null;
  for (ObjectCursor<String> cursor : state.metaData().indices().keys()) {
    String index = cursor.value;
    if (!previousState.metaData().hasIndex(index)) {
      if (created == null) {
        created = new ArrayList<>();
      }
      created.add(index);
    }
  }
  return created == null ? Collections.<String>emptyList() : created;
}

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

final Set<String> excludeIndexPathIds = new HashSet<>(metaData.indices().size() + danglingIndices.size());
for (ObjectCursor<IndexMetaData> cursor : metaData.indices().values()) {
  excludeIndexPathIds.add(cursor.value.getIndex().getUUID());

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

private List<Index> indicesDeletedFromClusterState() {
  // If the new cluster state has a new cluster UUID, the likely scenario is that a node was elected
  // master that has had its data directory wiped out, in which case we don't want to delete the indices and lose data;
  // rather we want to import them as dangling indices instead.  So we check here if the cluster UUID differs from the previous
  // cluster UUID, in which case, we don't want to delete indices that the master erroneously believes shouldn't exist.
  // See test DiscoveryWithServiceDisruptionsIT.testIndicesDeleted()
  // See discussion on https://github.com/elastic/elasticsearch/pull/9952 and
  // https://github.com/elastic/elasticsearch/issues/11665
  if (metaDataChanged() == false || isNewCluster()) {
    return Collections.emptyList();
  }
  List<Index> deleted = null;
  for (ObjectCursor<IndexMetaData> cursor : previousState.metaData().indices().values()) {
    IndexMetaData index = cursor.value;
    IndexMetaData current = state.metaData().index(index.getIndex());
    if (current == null) {
      if (deleted == null) {
        deleted = new ArrayList<>();
      }
      deleted.add(index.getIndex());
    }
  }
  return deleted == null ? Collections.<Index>emptyList() : deleted;
}

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

if (context == XContentContext.API && !metaData.indices().isEmpty()) {
  builder.startObject("indices");
  for (IndexMetaData indexMetaData : metaData) {

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

public boolean equalsAliases(MetaData other) {
  for (ObjectCursor<IndexMetaData> cursor : other.indices().values()) {
    IndexMetaData otherIndex = cursor.value;
    IndexMetaData thisIndex = index(otherIndex.getIndex());
    if (thisIndex == null) {
      return false;
    }
    if (otherIndex.getAliases().equals(thisIndex.getAliases()) == false) {
      return false;
    }
  }
  return true;
}

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

final IndexMetaData metaData = clusterState.getMetaData().indices().get(shardId.getIndexName());

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

public ImmutableOpenMap<String, IndexMetaData> getIndices() {
  return indices();
}

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

boolean hasIndexRequestsWithPipelines = false;
final MetaData metaData = clusterService.state().getMetaData();
ImmutableOpenMap<String, IndexMetaData> indicesMetaData = metaData.indices();
for (DocWriteRequest<?> actionRequest : bulkRequest.requests) {
  IndexRequest indexRequest = getIndexWriteRequest(actionRequest);

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

electedGlobalState = nodeState.metaData();
for (ObjectCursor<IndexMetaData> cursor : nodeState.metaData().indices().values()) {
  indices.addTo(cursor.value.getIndex(), 1);

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("Recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

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

@Override
public ClusterState execute(ClusterState currentState) {
  assert currentState.metaData().indices().isEmpty();
  for (ObjectCursor<IndexMetaData> cursor : updatedState.metaData().indices().values()) {
    routingTableBuilder.addAsRecovery(cursor.value);

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

private static boolean clusterHas5xIndices(ClusterState state) {
    final Iterator<IndexMetaData> indices = state.metaData().indices().valuesIt();
    for(;indices.hasNext();) {
      final IndexMetaData indexMetaData = indices.next();
      if(indexMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
        return true;
      }
    }
    return false;
  }
}

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

@Override
  public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
    logger.info("recovered [{}] indices into cluster_state", newState.metaData().indices().size());
  }
});

代码示例来源:origin: crate/elasticsearch-inout-plugin

private ImmutableMap<String, IndexMetaData> getIndexMetaData(Set<String> indexes) {
  ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
      .filterRoutingTable(true)
      .filterNodes(true)
      .filteredIndices(indexes.toArray(new String[indexes.size()]));
  clusterStateRequest.listenerThreaded(false);
  ClusterStateResponse response = client.admin().cluster().state(clusterStateRequest).actionGet();
  return ImmutableMap.copyOf(response.getState().metaData().indices());
}

相关文章

微信公众号

最新文章

更多