use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.core.CountResponse in project graylog2-server by Graylog2.
the class IndexToolsAdapterES7 method count.
@Override
public long count(Set<String> indices, Optional<Set<String>> includedStreams) {
final CountRequest request = new CountRequest(indices.toArray(new String[0]), buildStreamIdFilter(includedStreams)).indicesOptions(IndicesOptions.fromOptions(true, false, true, false));
final CountResponse result = client.execute((c, requestOptions) -> c.count(request, requestOptions), "Unable to count documents of index.");
return result.getCount();
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.core.CountResponse in project graylog2-server by Graylog2.
the class MessagesES7IT method messageCount.
@Override
protected long messageCount(String indexName) {
this.elasticsearch.elasticsearchClient().execute((c, requestOptions) -> c.indices().refresh(new RefreshRequest(), requestOptions));
final CountRequest countRequest = new CountRequest(indexName);
final CountResponse result = this.elasticsearch.elasticsearchClient().execute((c, requestOptions) -> c.count(countRequest, requestOptions));
return result.getCount();
}
Aggregations