use of org.elasticsearch.action.delete.DeleteRequest in project yacy_grid_mcp by yacy.
the class ElasticsearchClient method deleteBulk.
/**
* Delete a list of documents for a given set of ids
* ATTENTION: read about the time-out of version number checking in the method above.
*
* @param ids
* a map from the unique identifier of a document to the document type
* @return the number of deleted documents
*/
public int deleteBulk(String indexName, Map<String, String> ids) {
// bulk-delete the ids
if (ids == null || ids.size() == 0)
return 0;
BulkRequestBuilder bulkRequest = elasticsearchClient.prepareBulk();
for (Map.Entry<String, String> id : ids.entrySet()) {
bulkRequest.add(new DeleteRequest().id(id.getKey()).index(indexName).type(id.getValue()));
}
bulkRequest.execute().actionGet();
return ids.size();
}
use of org.elasticsearch.action.delete.DeleteRequest in project pinpoint by naver.
the class ElasticsearchExecutorInterceptor method recordeESattributes.
// TODO max dsl limit need
private void recordeESattributes(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
if (recordESVersion) {
if (target instanceof ClusterInfoAccessor) {
// record elasticsearch version and cluster name.
recorder.recordAttribute(ElasticsearchConstants.ARGS_VERSION_ANNOTATION_KEY, ((ClusterInfoAccessor) target)._$PINPOINT$_getClusterInfo());
}
}
if (recordDsl) {
if (args[0] instanceof SearchRequest) {
SearchRequest request = (SearchRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(request.source().toString(), 256));
} else if (args[0] instanceof GetRequest) {
// GetRequest request = (GetRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof IndexRequest) {
// IndexRequest request = (IndexRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof DeleteRequest) {
// DeleteRequest request = (DeleteRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
} else if (args[0] instanceof UpdateRequest) {
// UpdateRequest request = (UpdateRequest) args[0];
recorder.recordAttribute(ElasticsearchConstants.ARGS_DSL_ANNOTATION_KEY, StringUtils.abbreviate(args[0].toString(), 256));
}
}
}
Aggregations