当前位置: 首页>>代码示例>>Java>>正文


Java DeleteIndexResponse.isAcknowledged方法代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse.isAcknowledged方法的典型用法代码示例。如果您正苦于以下问题:Java DeleteIndexResponse.isAcknowledged方法的具体用法?Java DeleteIndexResponse.isAcknowledged怎么用?Java DeleteIndexResponse.isAcknowledged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse的用法示例。


在下文中一共展示了DeleteIndexResponse.isAcknowledged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: delete

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
/**
 * Delete an index in Elasticsearch.
 *
 * @param indexName
 *
 * @return true if the request was acknowledged.
 */
public static boolean delete(String indexName) {
  synchronized (Indices.class) {
    try {
      DeleteIndexResponse response = self.client.getClient().admin().indices().delete(new DeleteIndexRequest(indexName)).get();
      if (response.isAcknowledged()) {
        self.indexCache.remove(indexName);
        return true;
      } else {
        return false;
      }
    } catch (InterruptedException|ExecutionException e) {
      log.error("Error while deleting index", e);
      return false;
    }
  }
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:24,代码来源:Indices.java

示例2: cleanup

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
@After
public void cleanup() throws IOException
{
  try {
    DeleteIndexResponse delete = store.client.admin().indices().delete(new DeleteIndexRequest(INDEX_NAME)).actionGet();
    if (!delete.isAcknowledged()) {
      logger.error("Index wasn't deleted");
    }

    store.disconnect();
  } catch (NoNodeAvailableException e) {
    //This indicates that elasticsearch is not running on a particular machine.
    //Silently ignore in this case.
  }

}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:17,代码来源:ElasticSearchPercolateTest.java

示例3: deleteIndex

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
/**
 *
 */
private boolean deleteIndex(String indexName) {
    boolean val = false;
    try {
        DeleteIndexResponse deleteResponse = this.client.admin().indices().delete(new DeleteIndexRequest(indexName)).actionGet();

        if (deleteResponse.isAcknowledged()) {
            logger.info("Index {} deleted", indexName);
            val = true;
        } else {
            logger.error("Could not delete index " + indexName);
        }
    } catch (IndexNotFoundException e) {
        logger.info("Index " + indexName + " not found.");

    }
    return val;
}
 
开发者ID:anHALytics,项目名称:anhalytics-core,代码行数:21,代码来源:Indexer.java

示例4: deleteIndex

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
/**
 * This method will delete the index
 *
 * @param index String name of the index which we need to delete.
 * @return boolean
 */
public static boolean deleteIndex(String index) {
  boolean response = false;
  DeleteIndexResponse deleteResponse = ConnectionManager.getClient().admin().indices()
      .prepareDelete(index).get();
  if (deleteResponse != null && deleteResponse.isAcknowledged()) {
    response = true;
  }
  return response;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:16,代码来源:ElasticSearchUtil.java

示例5: clear

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
@Override
public void clear(Handler<AsyncResult<Void>> handler) {
    DeleteIndexResponse response = client.admin()
            .indices()
            .delete(new DeleteIndexRequest(context.database()))
            .actionGet();

    if (response.isAcknowledged()) {
        client.admin().indices().refresh(new RefreshRequest(context.database()));
        handler.handle(result());
        context.onCollectionDropped();
    } else {
        handler.handle(error(new StorageFailureException()));
    }
}
 
开发者ID:codingchili,项目名称:chili-core,代码行数:16,代码来源:ElasticMap.java

示例6: execute

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
/**
 * Deletes the INDEX with the specified name 
 * @param sql
 * @param drop
 * @return
 * @throws SQLException 
 */
public int execute(String sql, DropTable drop) throws SQLException {
	String index = drop.getTableName().toString();
	index = Heading.findOriginal(sql.trim()+";", index, "table\\s+",";");
	DeleteIndexResponse response = client.admin().indices().prepareDelete(index).execute().actionGet();
	if(!response.isAcknowledged()) throw new SQLException("Elasticsearch failed to delete the specified index");
	return 0;
}
 
开发者ID:Anchormen,项目名称:sql4es,代码行数:15,代码来源:ESUpdateState.java

示例7: createIndex

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
private void createIndex() throws Exception {

		boolean exists = client.admin().indices().prepareExists(mIndex).execute().actionGet().isExists();

		if (exists) {
			logger.log(Level.INFO, "Preexisting index " + mIndex + " will be removed.");
			DeleteIndexResponse deleteResponse = client.admin().indices().delete(new DeleteIndexRequest(mIndex)).actionGet();
			if (deleteResponse.isAcknowledged()) {
				logger.log(Level.INFO, "Preexisting index " + mIndex + " successfully removed.");
				exists = false;
			}
		}

		logger.log(Level.INFO, "Index " + mIndex + " will be created.");
		String docMapping = new String(Files.readAllBytes(Paths.get(documentMappingFile)));

		XContentBuilder builder = XContentFactory.jsonBuilder();
		XContentParser parser = XContentFactory.xContent(XContentType.JSON)
				.createParser(docMapping.getBytes());
		parser.close();
		builder.copyCurrentStructure(parser);

		CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(mIndex);
		createIndexRequestBuilder.addMapping(DOCUMENT_TYPE, builder);
		createIndexRequestBuilder.execute().actionGet();

	}
 
开发者ID:tudarmstadt-lt,项目名称:newsleak-frontend,代码行数:28,代码来源:ElasticsearchResource.java

示例8: clear

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
@Override
public boolean clear(MappingConfiguration mapping) {
    log.info("Deleting index '{}'", mapping.getIndex());
    DeleteIndexRequest request = new DeleteIndexRequest(mapping.getIndex());
    try {
        DeleteIndexResponse delete = getClient().admin().indices().delete(request).actionGet();
        log.info("Delete acknowledged: {}", delete.isAcknowledged());
        return delete.isAcknowledged();
    } catch (Exception e) {
        log.info("Index does not exist, no need to delete: {}", e.getMessage());
        return true;
    }
}
 
开发者ID:52North,项目名称:youngs,代码行数:14,代码来源:ElasticsearchSink.java

示例9: dropDataSet

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
@Override
public void dropDataSet() {
    final String indexName = config.getMisc().getDindex().getAs();
    IndicesAdminClient admin = client.getClient().admin().indices();
    IndicesExistsRequestBuilder builder = admin.prepareExists(indexName);
    if (builder.execute().actionGet().isExists()) {
        DeleteIndexResponse delete = admin.delete(new DeleteIndexRequest(indexName)).actionGet();
        if (delete.isAcknowledged())
            logger.info(String.format("The current index %s was deleted.", indexName));
        else
            logger.info(String.format("The current index %s was not deleted.", indexName));
    }
}
 
开发者ID:ozlerhakan,项目名称:mongolastic,代码行数:14,代码来源:ElasticBulkService.java

示例10: deleteIndex

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
public synchronized void deleteIndex() {
	DeleteIndexResponse response = client.admin().indices().delete(new DeleteIndexRequest(index)).actionGet();
	if (!response.isAcknowledged()) {
		throw new RuntimeException("cannot delete index " + index);
	}
	client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
}
 
开发者ID:ujmp,项目名称:universal-java-matrix-package,代码行数:8,代码来源:ElasticsearchIndex.java

示例11: truncate

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
@Override
public void truncate() {
    IndicesExistsResponse indicesExistsResponse = client.admin().indices().prepareExists(indexName + "*").execute().actionGet();
    if (indicesExistsResponse.isExists()) {
        DeleteIndexResponse response = client.admin().indices().prepareDelete(indexName + "*").execute().actionGet();
        if (!response.isAcknowledged()) {
            System.err.println("Index wasn't deleted");
        }
    }
}
 
开发者ID:Esri,项目名称:performance-test-harness-for-geoevent,代码行数:11,代码来源:ElasticSearchClient.java

示例12: deleteAllIndices

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
public void deleteAllIndices(String backendId) {

		String[] indices = toIndices(backendId);

		if (indices != null && indices.length > 0) {
			DeleteIndexResponse deleteIndexResponse = internalClient.admin().indices().prepareDelete(indices).get();

			if (!deleteIndexResponse.isAcknowledged())
				throw Exceptions.runtime(//
						"backend [%s] deletion not acknowledged by the whole cluster", //
						backendId);
		}
	}
 
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:14,代码来源:ElasticClient.java

示例13: deleteAll

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
public void deleteAll() {
    //there is no Java api to delete by query, so use admin
    try {
        DeleteIndexResponse delete = client.admin().indices().delete(new DeleteIndexRequest(esIndex)).actionGet();
        if (!delete.isAcknowledged()) {
            log.error("Index wasn't deleted");
        }
    } catch (IndexNotFoundException e) {
        //no problem, ignore it
    }
    //we use this operation to setup needed mappings for next adds too. This is somewhat customized for how DIH works
    //now we create the index again
    createIndex();
}
 
开发者ID:jmlucjav,项目名称:esURP,代码行数:15,代码来源:ESProcessor.java

示例14: deleteIndices

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
void deleteIndices(Client client, String indexName, int timeout) {
    DeleteIndexResponse deleteIndexResponse = client.admin().indices().prepareDelete(indexName).execute().actionGet(timeout);

    if (deleteIndexResponse.isAcknowledged()) {
        logger.info(indexName + " deleted");
    } else {
        logger.warn("Failed to delete " + indexName);
        throw new RuntimeException("Failed to delete " + indexName);
    }
}
 
开发者ID:Netflix,项目名称:Raigad,代码行数:11,代码来源:ElasticsearchIndexManager.java

示例15: deleteIndex

import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; //导入方法依赖的package包/类
public DeleteIndexResponse deleteIndex(final String index,
        final BuilderCallback<DeleteIndexRequestBuilder> builder) {
    final DeleteIndexResponse actionGet = builder
            .apply(client().admin().indices().prepareDelete(index))
            .execute().actionGet();
    if (!actionGet.isAcknowledged()) {
        onFailure("Failed to create " + index + ".", actionGet);
    }
    return actionGet;
}
 
开发者ID:codelibs,项目名称:elasticsearch-cluster-runner,代码行数:11,代码来源:ElasticsearchClusterRunner.java


注:本文中的org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse.isAcknowledged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。