private static String toElasticAggregate(Call call) {
    final AggregationOperators kind = (AggregationOperators) call.operator();
    switch (kind) {
      case COUNT:
        return "value_count";
      case SUM:
        return "sum";
      case MIN:
        return "min";
      case MAX:
        return "max";
      case AVG:
        return "avg";
      default:
        throw new IllegalArgumentException("Unknown aggregation kind " + kind + " for " + call);
    }
  }
Most of the aggregations can be retrieved with single
<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html">stats</a>
function. But currently only one-to-one mapping is supported between sql agg and elastic
aggregation.
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/AggregateQueryBuilder.java