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

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

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

IndicesAdminClient.prepareDeleteTemplate介绍

[英]Deletes an index template.
[中]删除索引模板。

代码示例

代码示例来源:origin: fr.pilato.elasticsearch/elasticsearch-beyonder

/**
 * Remove a template
 * @param client Elasticsearch client
 * @param template template name
 * @deprecated Will be removed when we don't support TransportClient anymore
 */
@Deprecated
public static void removeTemplate(Client client, String template) {
  logger.trace("removeTemplate({})", template);
  client.admin().indices().prepareDeleteTemplate(template).get();
  logger.trace("/removeTemplate({})", template);
}

代码示例来源:origin: dadoonet/elasticsearch-beyonder

/**
 * Remove a template
 * @param client Elasticsearch client
 * @param template template name
 * @deprecated Will be removed when we don't support TransportClient anymore
 */
@Deprecated
public static void removeTemplate(Client client, String template) {
  logger.trace("removeTemplate({})", template);
  client.admin().indices().prepareDeleteTemplate(template).get();
  logger.trace("/removeTemplate({})", template);
}

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

/**
 * Deletes index templates, support wildcard notation.
 * If no template name is passed to this method all templates are removed.
 */
public void wipeTemplates(String... templates) {
  if (size() > 0) {
    // if nothing is provided, delete all
    if (templates.length == 0) {
      templates = new String[]{"*"};
    }
    for (String template : templates) {
      try {
        client().admin().indices().prepareDeleteTemplate(template).execute().actionGet();
      } catch (IndexTemplateMissingException e) {
        // ignore
      }
    }
  }
}

代码示例来源:origin: dqeasycloud/easy-cloud

@Override
public boolean deleteIndexTemplate(String templateName) {
  return getIndicesAdminClient().prepareDeleteTemplate(templateName).execute().actionGet().isAcknowledged();
}

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

/**
 * Removes all templates, except the templates defined in the exclude
 */
public void wipeAllTemplates(Set<String> exclude) {
  if (size() > 0) {
    GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates().get();
    for (IndexTemplateMetaData indexTemplate : response.getIndexTemplates()) {
      if (exclude.contains(indexTemplate.getName())) {
        continue;
      }
      try {
        client().admin().indices().prepareDeleteTemplate(indexTemplate.getName()).execute().actionGet();
      } catch (IndexTemplateMissingException e) {
        // ignore
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

IndicesAdminClient类方法