本文整理汇总了Java中org.elasticsearch.action.delete.DeleteResponse.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java DeleteResponse.getResult方法的具体用法?Java DeleteResponse.getResult怎么用?Java DeleteResponse.getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.action.delete.DeleteResponse
的用法示例。
在下文中一共展示了DeleteResponse.getResult方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
@Override
public boolean delete(DeleteRequest request) {
StopWatch watch = new StopWatch();
String index = request.index == null ? this.index : request.index;
boolean deleted = false;
try {
DeleteResponse response = client().prepareDelete(index, type, request.id).get();
deleted = response.getResult() == DocWriteResponse.Result.DELETED;
return deleted;
} catch (ElasticsearchException e) {
throw new SearchException(e); // due to elastic search uses async executor to run, we have to wrap the exception to retain the original place caused the exception
} finally {
long elapsedTime = watch.elapsedTime();
ActionLogContext.track("elasticsearch", elapsedTime, 0, deleted ? 1 : 0);
logger.debug("delete, index={}, type={}, id={}, elapsedTime={}", index, type, request.id, elapsedTime);
checkSlowOperation(elapsedTime);
}
}
示例2: remove
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
@Override
public void remove(String workflowId) {
try {
DeleteRequest req = new DeleteRequest(indexName, WORKFLOW_DOC_TYPE, workflowId);
DeleteResponse response = client.delete(req).actionGet();
if (response.getResult() == DocWriteResponse.Result.DELETED) {
log.error("Index removal failed - document not found by id " + workflowId);
}
} catch (Throwable e) {
log.error("Index removal failed failed {}", e.getMessage(), e);
Monitors.error(className, "remove");
}
}
示例3: delete
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
public DeleteResponse delete(final String index, final String type,
final String id,
final BuilderCallback<DeleteRequestBuilder> builder) {
final DeleteResponse actionGet = builder
.apply(client().prepareDelete(index, type, id)).execute()
.actionGet();
if (actionGet.getResult() != Result.DELETED) {
onFailure("Failed to delete " + id + " from " + index + "/" + type
+ ".", actionGet);
}
return actionGet;
}
示例4: delById
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
public boolean delById(String id) {
DeleteResponse response = client.prepareDelete(INDEX_NAME, TYPE_NAME, id).get();
return response.getResult() == Result.DELETED;
}
示例5: delete
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
/**
* Delete a document for a given id.
* ATTENTION: deleted documents cannot be re-inserted again if version number
* checking is used and the new document does not comply to the version number
* rule. The information which document was deleted persists for one minute and
* then inserting documents with the same version number as before is possible.
* To modify this behavior, change the configuration setting index.gc_deletes
*
* @param id
* the unique identifier of a document
* @return true if the document existed and was deleted, false otherwise
*/
public boolean delete(String indexName, String typeName, final String id) {
DeleteResponse response = elasticsearchClient.prepareDelete(indexName, typeName, id).get();
return response.getResult() == DocWriteResponse.Result.DELETED;
}
示例6: deleteById
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
/**
* 根据id删除网页模板
*
* @param id 网页模板id
* @return 是否删除
*/
public boolean deleteById(String id) {
DeleteResponse response = client.prepareDelete(INDEX_NAME, TYPE_NAME, id).get();
return response.getResult() == DeleteResponse.Result.DELETED;
}
示例7: deleteById
import org.elasticsearch.action.delete.DeleteResponse; //导入方法依赖的package包/类
/**
* 根据id删除网页
*
* @param id 网页id
* @return 是否删除
*/
public boolean deleteById(String id) {
DeleteResponse response = client.prepareDelete(INDEX_NAME, TYPE_NAME, id).get();
return response.getResult() == DeleteResponse.Result.DELETED;
}