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

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

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

MetaData.getTemplates介绍

暂无

代码示例

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

void tryFinishUpgrade(AtomicBoolean anyUpgradeFailed) {
  assert upgradesInProgress.get() > 0;
  if (upgradesInProgress.decrementAndGet() == 1) {
    try {
      // this is the last upgrade, the templates should now be in the desired state
      if (anyUpgradeFailed.get()) {
        logger.info("Templates were partially upgraded to version {}", Version.CURRENT);
      } else {
        logger.info("Templates were upgraded successfully to version {}", Version.CURRENT);
      }
      // Check upgraders are satisfied after the update completed. If they still
      // report that changes are required, this might indicate a bug or that something
      // else tinkering with the templates during the upgrade.
      final ImmutableOpenMap<String, IndexTemplateMetaData> upgradedTemplates =
          clusterService.state().getMetaData().getTemplates();
      final boolean changesRequired = calculateTemplateChanges(upgradedTemplates).isPresent();
      if (changesRequired) {
        logger.warn("Templates are still reported as out of date after the upgrade. The template upgrade will be retried.");
      }
    } finally {
      final int noMoreUpgrades = upgradesInProgress.decrementAndGet();
      assert noMoreUpgrades == 0;
    }
  }
}

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

ImmutableOpenMap<String, IndexTemplateMetaData> templates = state.getMetaData().getTemplates();

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

if (applyPluginUpgraders(metaData.getTemplates(), metaDataUpgrader.indexTemplateMetaDataUpgraders,
  upgradedMetaData::removeTemplate, (s, indexTemplateMetaData) -> upgradedMetaData.put(indexTemplateMetaData))) {
  changed = true;

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

void tryFinishUpgrade(AtomicBoolean anyUpgradeFailed) {
  assert upgradesInProgress.get() > 0;
  if (upgradesInProgress.decrementAndGet() == 1) {
    try {
      // this is the last upgrade, the templates should now be in the desired state
      if (anyUpgradeFailed.get()) {
        logger.info("Templates were partially upgraded to version {}", Version.CURRENT);
      } else {
        logger.info("Templates were upgraded successfully to version {}", Version.CURRENT);
      }
      // Check upgraders are satisfied after the update completed. If they still
      // report that changes are required, this might indicate a bug or that something
      // else tinkering with the templates during the upgrade.
      final ImmutableOpenMap<String, IndexTemplateMetaData> upgradedTemplates =
          clusterService.state().getMetaData().getTemplates();
      final boolean changesRequired = calculateTemplateChanges(upgradedTemplates).isPresent();
      if (changesRequired) {
        logger.warn("Templates are still reported as out of date after the upgrade. The template upgrade will be retried.");
      }
    } finally {
      final int noMoreUpgrades = upgradesInProgress.decrementAndGet();
      assert noMoreUpgrades == 0;
    }
  }
}

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

void tryFinishUpgrade(AtomicBoolean anyUpgradeFailed) {
  assert upgradesInProgress.get() > 0;
  if (upgradesInProgress.decrementAndGet() == 1) {
    try {
      // this is the last upgrade, the templates should now be in the desired state
      if (anyUpgradeFailed.get()) {
        logger.info("Templates were partially upgraded to version {}", Version.CURRENT);
      } else {
        logger.info("Templates were upgraded successfuly to version {}", Version.CURRENT);
      }
      // Check upgraders are satisfied after the update completed. If they still
      // report that changes are required, this might indicate a bug or that something
      // else tinkering with the templates during the upgrade.
      final ImmutableOpenMap<String, IndexTemplateMetaData> upgradedTemplates =
          clusterService.state().getMetaData().getTemplates();
      final boolean changesRequired = calculateTemplateChanges(upgradedTemplates).isPresent();
      if (changesRequired) {
        logger.warn("Templates are still reported as out of date after the upgrade. The template upgrade will be retried.");
      }
    } finally {
      final int noMoreUpgrades = upgradesInProgress.decrementAndGet();
      assert noMoreUpgrades == 0;
    }
  }
}

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

ImmutableOpenMap<String, IndexTemplateMetaData> templates = state.getMetaData().getTemplates();

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

ImmutableOpenMap<String, IndexTemplateMetaData> templates = state.getMetaData().getTemplates();

代码示例来源:origin: com.github.tlrx/elasticsearch-test

/**
 * Get the names of templates to delete, if no template is provided the complete list of templates is retrieved
 */
private Collection<String> getTemplates(Client client) {
  Collection<String> templatesColl;
  if (this.templates==null || this.templates.length==0) {
    // Retrieve all templates
    ClusterStateRequestBuilder clusterStateRequestBuilder =
        ClusterStateAction.INSTANCE.newRequestBuilder(client.admin().cluster())
            .all().setMetaData(false);
    ClusterStateResponse clusterStateResponse = clusterStateRequestBuilder.execute().actionGet();
    templatesColl = Lists.newArrayList(clusterStateResponse.getState().getMetaData().getTemplates().keysIt());
  } else {
    // Use provided templates
    templatesColl = Arrays.asList(templates);
  }
  return templatesColl;
}
@Override

代码示例来源:origin: tlrx/elasticsearch-test

/**
 * Get the names of templates to delete, if no template is provided the complete list of templates is retrieved
 */
private Collection<String> getTemplates(Client client) {
  Collection<String> templatesColl;
  if (this.templates==null || this.templates.length==0) {
    // Retrieve all templates
    ClusterStateRequestBuilder clusterStateRequestBuilder =
        ClusterStateAction.INSTANCE.newRequestBuilder(client.admin().cluster())
            .all().setMetaData(false);
    ClusterStateResponse clusterStateResponse = clusterStateRequestBuilder.execute().actionGet();
    templatesColl = Lists.newArrayList(clusterStateResponse.getState().getMetaData().getTemplates().keysIt());
  } else {
    // Use provided templates
    templatesColl = Arrays.asList(templates);
  }
  return templatesColl;
}
@Override

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

newPersistentSettings.build(),
metaData.getIndices(),
metaData.getTemplates(),
metaData.getCustoms(),
metaData.getConcreteAllIndices(),

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

/** As of 2.0 we require units for time and byte-sized settings. This methods adds default units to any
 * persistent settings and template settings that don't specify a unit.
 **/
public static MetaData addDefaultUnitsIfNeeded(ESLogger logger, MetaData metaData) {
  Settings newPersistentSettings = addDefaultUnitsIfNeeded(
      CLUSTER_TIME_SETTINGS, CLUSTER_BYTES_SIZE_SETTINGS, logger, metaData.persistentSettings());
  ImmutableOpenMap<String, IndexTemplateMetaData> templates = updateTemplates(logger, metaData.getTemplates());
  if (newPersistentSettings != null || templates != null) {
    return new MetaData(
        metaData.clusterUUID(),
        metaData.version(),
        metaData.transientSettings(),
        MoreObjects.firstNonNull(newPersistentSettings, metaData.persistentSettings()),
        metaData.getIndices(),
        MoreObjects.firstNonNull(templates, metaData.getTemplates()),
        metaData.getCustoms(),
        metaData.concreteAllIndices(),
        metaData.concreteAllOpenIndices(),
        metaData.concreteAllClosedIndices(),
        metaData.getAliasAndIndexLookup());
  } else {
    // No changes:
    return metaData;
  }
}

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

if (applyPluginUpgraders(metaData.getTemplates(), metaDataUpgrader.indexTemplateMetaDataUpgraders,
  upgradedMetaData::removeTemplate, (s, indexTemplateMetaData) -> upgradedMetaData.put(indexTemplateMetaData))) {
  changed = true;

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

if (applyPluginUpgraders(metaData.getTemplates(), metaDataUpgrader.indexTemplateMetaDataUpgraders,
  upgradedMetaData::removeTemplate, (s, indexTemplateMetaData) -> upgradedMetaData.put(indexTemplateMetaData))) {
  changed = true;

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

if (applyPluginUpgraders(metaData.getTemplates(), metaDataUpgrader.indexTemplateMetaDataUpgraders,
  upgradedMetaData::removeTemplate, (s, indexTemplateMetaData) -> upgradedMetaData.put(indexTemplateMetaData))) {
  changed = true;

代码示例来源:origin: jprante/elasticsearch-skywalker

ImmutableOpenMap<String,IndexTemplateMetaData> templates = metadata.getTemplates();
for (ObjectCursor<String> s : templates.keys()) {
  IndexTemplateMetaData itmd = templates.get(s.value);

相关文章