code: private static int lookup(final TSDB tsdb,
                              final boolean use_data_table,
                              final String[] args) throws Exception {
      if (!use_data_table) {
        tsdb.getClient().ensureTableExists(
            tsdb.getConfig().getString(
                "tsd.storage.hbase.meta_table")).joinUninterruptibly();
      }
      
      final SearchQuery query = new SearchQuery();
      query.setType(SearchType.LOOKUP);
      
      int index = 1;
      if (!args[index].contains("=")) {
        query.setMetric(args[index++]);
      }
      
      final List<Pair<String, String>> tags = 
          new ArrayList<Pair<String, String>>(args.length - index);
      for (; index < args.length; index++) {
        Tags.parse(tags, args[index]);
      }
      query.setTags(tags);
      if (use_data_table) {
        query.setUseMeta(false);
        LOG.warn("NOTE: Scanning the full data table may take a long time");
      }
      
      final TimeSeriesLookup lookup = new TimeSeriesLookup(tsdb, query);
      lookup.setToStdout(true);
      lookup.lookup();
      return 0;
    }
docs: Performs a time series lookup given a query like "metric tagk=tagv" where
  a list of all time series containing the given metric and tag pair will be
  dumped to standard out. Tag pairs can be given with empty tagk or tagvs to
  and the metric is option. E.g. a query of "=web01" will return all time
  series with a tag value of "web01".
  By default the lookup is performed against the tsdb-meta table. If the
  "--use_data_table" flag is supplied, the main data table will be scanned.
  @param tsdb The TSDB to use for communication
  @param use_data_table Whether or not lookups should be done on the full
  data table
  @param args Arguments to parse
  @return An exit code