Search in sources :

Example 1 with StringTermsBucket

use of org.opensearch.client.opensearch._types.aggregations.StringTermsBucket in project core-ng-project by neowu.

the class ArchDiagram method load.

private void load(String app, List<StringTermsBucket> actions) {
    if (excludeApps.contains(app))
        return;
    for (StringTermsBucket actionBucket : actions) {
        String action = actionBucket.key();
        long totalCount = actionBucket.docCount();
        List<StringTermsBucket> clients = actionBucket.aggregations().get("client").sterms().buckets().array();
        for (StringTermsBucket clientBucket : clients) {
            String client = clientBucket.key();
            long count = clientBucket.docCount();
            loadAction(app, action, client, count);
        }
        long totalByClient = clients.stream().mapToLong(StringTermsBucket::docCount).sum();
        if (totalCount > totalByClient) {
            loadAction(app, action, "_direct_" + app, totalCount - totalByClient);
        }
    }
}
Also used : StringTermsBucket(co.elastic.clients.elasticsearch._types.aggregations.StringTermsBucket)

Aggregations

StringTermsBucket (co.elastic.clients.elasticsearch._types.aggregations.StringTermsBucket)1