• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DeleteIndex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.searchbox.indices.DeleteIndex的典型用法代码示例。如果您正苦于以下问题:Java DeleteIndex类的具体用法?Java DeleteIndex怎么用?Java DeleteIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DeleteIndex类属于io.searchbox.indices包,在下文中一共展示了DeleteIndex类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deleteAll

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
@Override
public void deleteAll() throws IOException {
  // Delete the index, if it exists.
  JestResult result = client.execute(new IndicesExists.Builder(indexName).build());
  if (result.isSucceeded()) {
    result = client.execute(new DeleteIndex.Builder(indexName).build());
    if (!result.isSucceeded()) {
      throw new IOException(
          String.format("Failed to delete index %s: %s", indexName, result.getErrorMessage()));
    }
  }

  // Recreate the index.
  result = client.execute(new CreateIndex.Builder(indexName).settings(getMappings()).build());
  if (!result.isSucceeded()) {
    String error =
        String.format("Failed to create index %s: %s", indexName, result.getErrorMessage());
    throw new IOException(error);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:AbstractElasticIndex.java


示例2: builderIndex_OneRecord

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
public void builderIndex_OneRecord(String json, boolean cleanBeforeInsert) {
  long start = System.currentTimeMillis();
  try {
    if (cleanBeforeInsert) {
      jestHttpClient.execute(new DeleteIndex(new DeleteIndex.Builder(_esIndexName)));
    }
    JestResult jestResult = jestHttpClient.execute(new IndicesExists.Builder(_esIndexName).build());
    if (!jestResult.isSucceeded()) {
      jestHttpClient.execute(new CreateIndex.Builder(_esIndexName).build());
    }

    Index index = new Index.Builder(json)
    .index(_esIndexName)
    .type(_esTypeName)
    .build();
    jestHttpClient.execute(index);
    //            jestHttpClient.shutdownClient();
  } catch (Exception e) {
    e.printStackTrace();
  }
  long end = System.currentTimeMillis();
  LOG.info("->> One Record(default id): time for create index --> " + (end - start) + " milliseconds"); 
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:24,代码来源:JestElasticsearchManipulator.java


示例3: builderIndex_Bulk

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
public void builderIndex_Bulk(List<Entity> entityList, boolean cleanBeforeInsert) {
  int nRecords = entityList.size();
  long start = System.currentTimeMillis();
  try {
    if (cleanBeforeInsert) {
      jestHttpClient.execute(new DeleteIndex(new DeleteIndex.Builder(_esIndexName)));
    }
    JestResult jestResult = jestHttpClient.execute(new IndicesExists.Builder(_esIndexName).build());
    if (!jestResult.isSucceeded()) {
      jestHttpClient.execute(new CreateIndex.Builder(_esIndexName).build());
    }


    SerializeBeans2JSON sb2json = new SerializeBeans2JSON(); 
    Bulk.Builder bulkBuilder = new Bulk.Builder();
    for (int i = 0; i < nRecords; i++) {
      Index index = new Index
          .Builder(sb2json.serializeBeans2JSON(entityList.get(i)))
      .index(_esIndexName)
      .type(_esTypeName)
      .id(entityList.get(i).getEntityID())
      .build();
      bulkBuilder.addAction(index);
    }
    jestHttpClient.execute(bulkBuilder.build());
  } catch (Exception e) {
    e.printStackTrace();
  }
  long end = System.currentTimeMillis();
  LOG.info("->> Bulk: total time for create index --> " + (end - start) + " milliseconds, # of records: " + nRecords); 
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:32,代码来源:JestElasticsearchManipulator.java


示例4: delIndex

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
@Override
public boolean delIndex(String index) throws Exception {
	try {
		JestResult result = _exec(new DeleteIndex.Builder(index).build());
		return result != null;
	} catch (Exception e) {
		e.printStackTrace();
	}
	return false;
}
 
开发者ID:DataSays,项目名称:wES,代码行数:11,代码来源:JestClient.java


示例5: deleteIndex

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
public void deleteIndex() {
    try {
        if (indexCreated) {
            logger.info("Deleting test index {} from ES", indexName);
            client.execute(new DeleteIndex.Builder(indexName).build());
        }

    } catch (IOException e) {
        throw new RuntimeException("Could not delete index from ES!", e);
    }
}
 
开发者ID:logzio,项目名称:elasticsearch-benchmark-tool,代码行数:12,代码来源:ElasticsearchController.java


示例6: deleteIndex

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
/**
 * The delete index function will take as an argument the index name and will delete the index.
 */
@Override
public final void deleteIndex(String indexName)
{
    Action action = new DeleteIndex.Builder(indexName).build();

    LOGGER.info("Deleting Elasticsearch index, indexName={}.", indexName);
    JestResult result = jestClientHelper.executeAction(action);

    LOGGER.info("Deleting Elasticsearch index, indexName={}. result successful is {} ", indexName, result.isSucceeded());
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:14,代码来源:IndexFunctionsDaoImpl.java


示例7: delete

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
/**
 * Delete the given index and all of its documents.
 * 
 * @param index The name of the index to delete.
 */
public void delete(String index) {
  JestResult result = execute(new DeleteIndex.Builder(index).build());
  if (!result.isSucceeded()) {
    throw new ElasticsearchIndexDeleteException(index, result.getErrorMessage());
  }
}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:12,代码来源:ElasticsearchDao.java


示例8: stop

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
/**
 * Stop the server.
 * @throws Exception
 */
public void stop() throws Exception {
    server.stop();
    if (ds != null) {
        ds.close();
        InitialContext ctx = TestUtil.initialContext();
        ctx.unbind("java:comp/env/jdbc/ApiManagerDS");
    }
    if (node != null) {
        if ("true".equals(System.getProperty("apiman.test.es-delete-index", "true"))) {
        	client.execute(new DeleteIndex.Builder("apiman_manager").build());
        }
    }
}
 
开发者ID:apiman,项目名称:apiman,代码行数:18,代码来源:ManagerApiTestServer.java


示例9: deleteIndex

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
@Override
public boolean deleteIndex(String indexName) {
	Assert.notNull(indexName, "No index defined for delete operation");
	return indexExists(indexName) && executeWithAcknowledge(new DeleteIndex.Builder(indexName).build());
}
 
开发者ID:VanRoy,项目名称:spring-data-jest,代码行数:6,代码来源:JestElasticsearchTemplate.java


示例10: dropIdexes

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
public void dropIdexes() {
    for (String index : getEsIndices(true)) {
        log.info("dropping {}", index);
        es.execute(new DeleteIndex.Builder(index).build());
    }
}
 
开发者ID:ruediste,项目名称:rise,代码行数:7,代码来源:EsManagementService.java


示例11: deleteIndex

import io.searchbox.indices.DeleteIndex; //导入依赖的package包/类
public void deleteIndex() {
    execute(new DeleteIndex.Builder(index).build());
}
 
开发者ID:spring-io,项目名称:sagan,代码行数:4,代码来源:SearchIndexSetup.java



注:本文中的io.searchbox.indices.DeleteIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AutoCompleteSettings类代码示例发布时间:2022-05-22
下一篇:
Java DSAParametersGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap