本文整理汇总了Java中org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder类的典型用法代码示例。如果您正苦于以下问题:Java DeleteByQueryRequestBuilder类的具体用法?Java DeleteByQueryRequestBuilder怎么用?Java DeleteByQueryRequestBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeleteByQueryRequestBuilder类属于org.elasticsearch.action.deletebyquery包,在下文中一共展示了DeleteByQueryRequestBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: delete
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@DeleteMapping(value = "/{id}")
public ResponseEntity delete(@PathVariable String id) throws IOException {
LOG.info("Try to delete document {}", id);
counterService.increment("counter.calls.document.id.delete");
if (client.prepareDelete("steckbrief", "steckbrief", id).execute().actionGet().isFound()) {
new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE)
.setIndices("changeset")
.setTypes("changeset")
.setQuery(QueryBuilders.matchQuery("document", id))
.execute()
.actionGet();
LOG.info("Deleted document {} successfully", id);
return ResponseEntity.noContent().build();
}
else {
LOG.warn("Could not delete document {}", id);
return ResponseEntity.notFound().build();
}
}
开发者ID:pivio,项目名称:pivio-server,代码行数:20,代码来源:DocumentController.java
示例2: explain
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
public static String explain(ActionRequestBuilder actionRequest) throws IOException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, SQLFeatureNotSupportedException {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).prettyPrint();
if (actionRequest instanceof SearchRequestBuilder) {
((SearchRequestBuilder) actionRequest).internalBuilder().toXContent(builder, ToXContent.EMPTY_PARAMS);
} else if (actionRequest instanceof DeleteByQueryRequestBuilder) {
// access private method to get the explain...
DeleteByQueryRequestBuilder deleteRequest = ((DeleteByQueryRequestBuilder) actionRequest);
Method method = deleteRequest.getClass().getDeclaredMethod("sourceBuilder");
method.setAccessible(true);
QuerySourceBuilder sourceBuilder = (QuerySourceBuilder) method.invoke(deleteRequest);
sourceBuilder.toXContent(builder, ToXContent.EMPTY_PARAMS);
} else {
throw new SQLFeatureNotSupportedException(String.format("Failed to explain class %s", actionRequest.getClass().getName()));
}
return builder.string();
}
开发者ID:lane-cn,项目名称:elasticsql,代码行数:19,代码来源:ExplainManager.java
示例3: delete
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public void delete(String query, String type, EzSecurityToken userToken) throws TException {
final Stopwatch watch = LoggingUtils.createStopWatch();
final VisibilityFilterConfig filterConfig =
new VisibilityFilterConfig(VISIBILITY_FIELD, EnumSet.of(Permission.READ, Permission.WRITE));
final DeleteByQueryRequestBuilder builder = client.prepareDeleteByQuery(indexName).setQuery(
QueryBuilders.filteredQuery(parseQuery(query), getVisibilityFilter(userToken, filterConfig)));
if (!StringUtils.isEmpty(type)) {
builder.setTypes(type);
}
builder.get();
// Refresh immediately on deletes
forceIndexRefresh();
LoggingUtils.stopAndLogStopWatch(logger, watch, "Delete And Refresh");
}
开发者ID:ezbake,项目名称:ezelastic,代码行数:19,代码来源:ElasticClient.java
示例4: deleteOldFiles
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
private void deleteOldFiles(String repo, List<String> projectsUpdated) {
String cutoffDate = DevSearchDateFormat.format(lastIndexDateForProjects);
LOG.info("deleting all previously indexed files for {}::{} with cutoff {}",repo, projectsUpdated, cutoffDate);
for (String projectName : projectsUpdated) {
// Not terribly efficient, but terms query has a size limit.
DeleteByQueryRequestBuilder deleteRequest = esClient.prepareDeleteByQuery(codeIndex)
.setTypes(DOC_TYPE)
.setQuery(QueryBuilders.boolQuery()
// .must(QueryBuilders.inQuery("project", projectsUpdated))
.must(QueryBuilders.termQuery("project", projectName))
.must(QueryBuilders.termQuery("repo", repo))
.mustNot(QueryBuilders.rangeQuery("lastIndexed").gte(cutoffDate)));
DeleteByQueryResponse response = deleteRequest.execute().actionGet();
checkForFailures(projectName, response);
}
LOG.info("done deleting all previously indexed files");
}
开发者ID:raymyers,项目名称:dev-search,代码行数:18,代码来源:LocalRepoCrawler.java
示例5: clearIndex
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public Completable clearIndex(String indexName) {
return Completable.create(sub -> {
long start = System.currentTimeMillis();
if (log.isDebugEnabled()) {
log.debug("Clearing index {" + indexName + "}");
}
DeleteByQueryRequestBuilder builder = new DeleteByQueryRequestBuilder(getSearchClient(), DeleteByQueryAction.INSTANCE);
builder.setIndices(indexName).setQuery(QueryBuilders.matchAllQuery()).execute().addListener(new ActionListener<DeleteByQueryResponse>() {
public void onResponse(DeleteByQueryResponse response) {
if (log.isDebugEnabled()) {
log.debug("Clearing index {" + indexName + "}. Duration " + (System.currentTimeMillis() - start) + "[ms]");
}
sub.onComplete();
};
@Override
public void onFailure(Throwable e) {
if (e instanceof IndexNotFoundException) {
if (log.isDebugEnabled()) {
log.debug("Clearing index failed since the index does not exists. We ignore this error", e);
}
sub.onComplete();
} else {
log.error("Clearing index {" + indexName + "} failed. Duration " + (System.currentTimeMillis() - start) + "[ms]", e);
sub.onError(e);
}
}
});
});
}
开发者ID:gentics,项目名称:mesh,代码行数:34,代码来源:ElasticSearchProvider.java
示例6: explain
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public DeleteByQueryRequestBuilder explain() throws SqlParseException {
this.request = client.prepareDeleteByQuery();
request.setListenerThreaded(false);
setIndicesAndTypes();
setWhere(delete.getWhere());
return request;
}
开发者ID:lane-cn,项目名称:elasticsql,代码行数:10,代码来源:DeleteQueryAction.java
示例7: deleteDocuments
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
public DeleteByQueryResponse deleteDocuments(String index, String type, String querySource) throws ElasticSearchException, EsServerException {
DeleteByQueryRequestBuilder rb = getClient().prepareDeleteByQuery(index);
rb.setQuery(querySource);
rb.setTypes(type);
return rb.execute().actionGet();
}
开发者ID:chrisGerken,项目名称:rankenphile,代码行数:9,代码来源:EsClient.java
示例8: addQ
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
protected void addQ(DeleteByQueryRequestBuilder builder, BoolFilterBuilder boolFilter) {
if (types.length > 0) {
builder.setTypes(types);
}
if (query.getQ() != null && !query.getQ().isEmpty()) {
boolFilter.must(queryFilter(queryString(query.getQ()).defaultOperator(Operator.AND)));
}
}
开发者ID:scaleset,项目名称:scaleset-search,代码行数:9,代码来源:DefaultQueryConverter.java
示例9: deleteRequest
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public DeleteByQueryRequestBuilder deleteRequest() {
DeleteByQueryRequestBuilder builder = client.prepareDeleteByQuery(indices);
BoolFilterBuilder boolFilter = boolFilter();
addQ(builder, boolFilter);
addFilters(boolFilter);
addBbox(boolFilter);
setFilter(builder, boolFilter);
return builder;
}
开发者ID:scaleset,项目名称:scaleset-search,代码行数:11,代码来源:DefaultQueryConverter.java
示例10: deleteOldProjects
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
private void deleteOldProjects(String repo) {
String cutoffDate = DevSearchDateFormat.format(lastIndexDateForProjects);
LOG.info("deleting all projects in {} last indexed before {}",repo, cutoffDate);
DeleteByQueryRequestBuilder deleteRequest = esClient.prepareDeleteByQuery(codeIndex)
.setTypes(PROJECT_TYPE)
.setQuery(QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("repo", repo))
.mustNot(QueryBuilders.rangeQuery("lastIndexed").gte(cutoffDate)));
DeleteByQueryResponse response = deleteRequest.execute().actionGet();
checkForFailures(repo, response);
}
开发者ID:raymyers,项目名称:dev-search,代码行数:13,代码来源:LocalRepoCrawler.java
示例11: deleteOldProjectFiles
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
private void deleteOldProjectFiles(Project project) {
String cutoffDate = DevSearchDateFormat.format(lastIndexDateForProjects);
LOG.info("deleting all files from project {} last indexed before {}",project.getId(), cutoffDate);
DeleteByQueryRequestBuilder deleteRequest = esClient.prepareDeleteByQuery(codeIndex)
.setTypes(DOC_TYPE)
.setQuery(QueryBuilders.boolQuery()
.must(QueryBuilders.termQuery("repo", project.getRepo()))
.must(QueryBuilders.termQuery("project", project.getName()))
.mustNot(QueryBuilders.rangeQuery("lastIndexed").gte(cutoffDate)));
DeleteByQueryResponse response = deleteRequest.execute().actionGet();
checkForFailures(project.getId(), response);
}
开发者ID:raymyers,项目名称:dev-search,代码行数:15,代码来源:LocalRepoCrawler.java
示例12: setFilter
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
protected void setFilter(DeleteByQueryRequestBuilder builder, BoolFilterBuilder boolFilter) {
if (boolFilter.hasClauses()) {
builder.setQuery(filteredQuery(matchAllQuery(), boolFilter));
}
}
开发者ID:scaleset,项目名称:scaleset-search,代码行数:6,代码来源:DefaultQueryConverter.java
示例13: deleteByQuery
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public void deleteByQuery(Query query) throws Exception {
DeleteByQueryRequestBuilder builder = createConverter(query).deleteRequest();
DeleteByQueryResponse response = builder.execute().actionGet();
}
开发者ID:scaleset,项目名称:scaleset-search,代码行数:6,代码来源:ElasticSearchDao.java
示例14: deletePortletDocuments
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
@Override
public void deletePortletDocuments(
SearchContext searchContext, String portletId)
throws SearchException {
try {
Client client = getClient();
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE);
deleteByQueryRequestBuilder.setIndices(Utilities.getIndexName(searchContext));
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
boolQueryBuilder.must(
QueryBuilders.termQuery(Field.PORTLET_ID, portletId));
deleteByQueryRequestBuilder.setQuery(boolQueryBuilder);
Future<DeleteByQueryResponse> future =
deleteByQueryRequestBuilder.execute();
future.get();
} catch (Exception e) {
_log.debug("Unable to delete portlet document with id " + portletId + "with error: " + e.getMessage());
throw new SearchException(
"Unable to delete data for portlet " + portletId, e);
}
}
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:32,代码来源:ElasticsearchIndexWriter.java
示例15: deleteRequest
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder; //导入依赖的package包/类
DeleteByQueryRequestBuilder deleteRequest();
开发者ID:scaleset,项目名称:scaleset-search,代码行数:2,代码来源:QueryConverter.java
注:本文中的org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论