@Test
public void testAgg() {

  // Single-value metric
  InterpreterResult res = interpreter.interpret("search /logs { \"aggs\" : { \"distinct_status_count\" : " +
          " { \"cardinality\" : { \"field\" : \"status\" } } } }", null);
  assertEquals(Code.SUCCESS, res.code());
  // Multi-value metric
  res = interpreter.interpret("search /logs { \"aggs\" : { \"content_length_stats\" : " +
          " { \"extended_stats\" : { \"field\" : \"content_length\" } } } }", null);
  assertEquals(Code.SUCCESS, res.code());
  // Single bucket
  res = interpreter.interpret("search /logs { \"aggs\" : { " +
          " \"200_OK\" : { \"filter\" : { \"term\": { \"status\": \"200\" } }, " +
          "   \"aggs\" : { \"avg_length\" : { \"avg\" : { \"field\" : \"content_length\" } } } } } }", null);
  assertEquals(Code.SUCCESS, res.code());
  // Multi-buckets
  res = interpreter.interpret("search /logs { \"aggs\" : { \"status_count\" : " +
          " { \"terms\" : { \"field\" : \"status\" } } } }", null);
  assertEquals(Code.SUCCESS, res.code());
}