本文整理了Java中org.elasticsearch.indices.IndicesService.hasIndex()
方法的一些代码示例,展示了IndicesService.hasIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesService.hasIndex()
方法的具体详情如下:
包路径:org.elasticsearch.indices.IndicesService
类名称:IndicesService
方法名:hasIndex
暂无
代码示例来源:origin: org.elasticsearch/elasticsearch
final IndexEventListener listener;
synchronized (this) {
if (hasIndex(index) == false) {
return;
代码示例来源:origin: org.elasticsearch/elasticsearch
if (hasIndex(index)) {
throw new ResourceAlreadyExistsException(index);
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Deletes the index store trying to acquire all shards locks for this index.
* This method will delete the metadata for the index even if the actual shards can't be locked.
*
* Package private for testing
*/
void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException {
if (nodeEnv.hasNodeFile()) {
synchronized (this) {
Index index = metaData.getIndex();
if (hasIndex(index)) {
String localUUid = indexService(index).indexUUID();
throw new IllegalStateException("Can't delete index store for [" + index.getName() +
"] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]");
}
if (clusterState.metaData().hasIndex(index.getName()) && (clusterState.nodes().getLocalNode().isMasterNode() == true)) {
// we do not delete the store if it is a master eligible node and the index is still in the cluster state
// because we want to keep the meta data for indices around even if no shards are left here
final IndexMetaData idxMeta = clusterState.metaData().index(index.getName());
throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the " +
"cluster state [" + idxMeta.getIndexUUID() + "] [" + metaData.getIndexUUID() + "], " +
"we are master eligible, so will keep the index metadata even if no shards are left.");
}
}
final IndexSettings indexSettings = buildIndexSettings(metaData);
deleteIndexStore(reason, indexSettings.getIndex(), indexSettings);
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
final IndexEventListener listener;
synchronized (this) {
if (hasIndex(index) == false) {
return;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
final IndexEventListener listener;
synchronized (this) {
if (hasIndex(index) == false) {
return;
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
if (hasIndex(index)) {
throw new ResourceAlreadyExistsException(index);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
if (hasIndex(index)) {
throw new ResourceAlreadyExistsException(index);
代码示例来源:origin: harbby/presto-connectors
private void applyMappings(ClusterChangedEvent event) {
if (!indicesService.hasIndex(indexMetaData.getIndex())) {
代码示例来源:origin: harbby/presto-connectors
private void applySettings(ClusterChangedEvent event) {
if (!event.metaDataChanged()) {
return;
}
for (IndexMetaData indexMetaData : event.state().metaData()) {
if (!indicesService.hasIndex(indexMetaData.getIndex())) {
// we only create / update here
continue;
}
// if the index meta data didn't change, no need check for refreshed settings
if (!event.indexMetaDataChanged(indexMetaData)) {
continue;
}
String index = indexMetaData.getIndex();
IndexService indexService = indicesService.indexService(index);
if (indexService == null) {
// already deleted on us, ignore it
continue;
}
IndexSettingsService indexSettingsService = indexService.injector().getInstance(IndexSettingsService.class);
indexSettingsService.refreshSettings(indexMetaData.getSettings());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Deletes the index store trying to acquire all shards locks for this index.
* This method will delete the metadata for the index even if the actual shards can't be locked.
*
* Package private for testing
*/
void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException {
if (nodeEnv.hasNodeFile()) {
synchronized (this) {
Index index = metaData.getIndex();
if (hasIndex(index)) {
String localUUid = indexService(index).indexUUID();
throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]");
}
if (clusterState.metaData().hasIndex(index.getName()) && (clusterState.nodes().getLocalNode().isMasterNode() == true)) {
// we do not delete the store if it is a master eligible node and the index is still in the cluster state
// because we want to keep the meta data for indices around even if no shards are left here
final IndexMetaData idxMeta = clusterState.metaData().index(index.getName());
throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the " +
"cluster state [" + idxMeta.getIndexUUID() + "] [" + metaData.getIndexUUID() + "], " +
"we are master eligible, so will keep the index metadata even if no shards are left.");
}
}
final IndexSettings indexSettings = buildIndexSettings(metaData);
deleteIndexStore(reason, indexSettings.getIndex(), indexSettings);
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Deletes the index store trying to acquire all shards locks for this index.
* This method will delete the metadata for the index even if the actual shards can't be locked.
*
* Package private for testing
*/
void deleteIndexStore(String reason, IndexMetaData metaData, ClusterState clusterState) throws IOException {
if (nodeEnv.hasNodeFile()) {
synchronized (this) {
Index index = metaData.getIndex();
if (hasIndex(index)) {
String localUUid = indexService(index).indexUUID();
throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the indices service [" + localUUid + "] [" + metaData.getIndexUUID() + "]");
}
if (clusterState.metaData().hasIndex(index.getName()) && (clusterState.nodes().getLocalNode().isMasterNode() == true)) {
// we do not delete the store if it is a master eligible node and the index is still in the cluster state
// because we want to keep the meta data for indices around even if no shards are left here
final IndexMetaData idxMeta = clusterState.metaData().index(index.getName());
throw new IllegalStateException("Can't delete index store for [" + index.getName() + "] - it's still part of the " +
"cluster state [" + idxMeta.getIndexUUID() + "] [" + metaData.getIndexUUID() + "], " +
"we are master eligible, so will keep the index metadata even if no shards are left.");
}
}
final IndexSettings indexSettings = buildIndexSettings(metaData);
deleteIndexStore(reason, indexSettings.getIndex(), indexSettings);
}
}
代码示例来源:origin: harbby/presto-connectors
if (indexMetaData != null && indicesService.hasIndex(index) == false) {
代码示例来源:origin: harbby/presto-connectors
private void applyNewIndices(final ClusterChangedEvent event) {
// we only create indices for shards that are allocated
RoutingNodes.RoutingNodeIterator routingNode = event.state().getRoutingNodes().routingNodeIter(event.state().nodes().localNodeId());
if (routingNode == null) {
return;
}
for (ShardRouting shard : routingNode) {
if (!indicesService.hasIndex(shard.index())) {
final IndexMetaData indexMetaData = event.state().metaData().index(shard.index());
if (logger.isDebugEnabled()) {
logger.debug("[{}] creating index", indexMetaData.getIndex());
}
try {
indicesService.createIndex(indexMetaData.getIndex(), indexMetaData.getSettings(), event.state().nodes().localNode().id());
} catch (Throwable e) {
sendFailShard(shard, indexMetaData.getIndexUUID(), "failed to create index", e);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!