docs: public void execute(final TSDB tsdb, final HttpQuery query) 
      throws IOException {
      
      // only accept GET/POST
      if (query.method() != HttpMethod.GET && query.method() != HttpMethod.POST) {
        throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, 
            "Method not allowed", "The HTTP method [" + query.method().getName() +
            "] is not permitted for this endpoint");
      }
      
      final String type;
      final String q;
      final String max;
      if (query.apiVersion() > 0 && query.method() == HttpMethod.POST) {
        final HashMap<String, String> map = query.serializer().parseSuggestV1();
        type = map.get("type");
        if (type == null || type.isEmpty()) {
          throw new BadRequestException("Missing 'type' parameter");
        }
        q = map.get("q") == null ? "" : map.get("q");
        max = map.get("max");
      } else { 
        type = query.getRequiredQueryStringParam("type");
        q = query.hasQueryStringParam("q") ? query.getQueryStringParam("q") : "";
        max = query.getQueryStringParam("max");
      }
      
      final int max_results;
      if (max != null && !max.isEmpty()) {
        try {
          max_results = Integer.parseInt(max);
        } catch (NumberFormatException nfe) {
          throw new BadRequestException("Unable to parse 'max' as a number");
        }
      } else {
        max_results = 0;
      }
      
      List<String> suggestions;
      if ("metrics".equals(type)) {
        suggestions = max_results > 0 ? tsdb.suggestMetrics(q, max_results) :
           tsdb.suggestMetrics(q);
      } else if ("tagk".equals(type)) {
        suggestions = max_results > 0 ? tsdb.suggestTagNames(q, max_results) :
           tsdb.suggestTagNames(q);
      } else if ("tagv".equals(type)) {
        suggestions = max_results > 0 ? tsdb.suggestTagValues(q, max_results) :
          tsdb.suggestTagValues(q);
      } else {
        throw new BadRequestException("Invalid 'type' parameter:" + type);
      }
      
      if (query.apiVersion() > 0) {
        query.sendReply(query.serializer().formatSuggestV1(suggestions));
      } else { // deprecated API
        query.sendReply(JSON.serializeToBytes(suggestions));
      }
    }