blueflood-elasticsearch/src/main/java/com/rackspacecloud/blueflood/io/ElasticTokensIO.java
private List<MetricName> searchESByIndexes(String tenantId, String query, String[] indexes) {
        if (StringUtils.isEmpty(query)) return new ArrayList<>();

        Timer.Context timerCtx = esMetricNamesQueryTimer.time();
        try {
            String response = elasticsearchRestHelper.fetchTokenDocuments(indexes, tenantId, query);

            List<MetricName> metricNames = getMetricNames(response);
            Set<MetricName> uniqueMetricNames = new HashSet<>(metricNames);
            return new ArrayList<>(uniqueMetricNames);
        } catch (IOException e) {
            log.error("IOException: Elasticsearch token query failed for tenantId {}. {}", tenantId, e.getMessage());
            throw new RuntimeException(String.format("searchESByIndexes failed with message: %s", e.getMessage()), e);
        } catch (Exception e) {
            log.error("Exception: Elasticsearch token query failed for tenantId {}. {}", tenantId, e.getMessage());
            throw new RuntimeException(String.format("searchESByIndexes failed with message: %s", e.getMessage()), e);
        } finally {
            timerCtx.stop();
        }
    }
private List<MetricName> searchESByIndexes(String tenantId, String query, String[] indexes) {
        if (StringUtils.isEmpty(query)) return new ArrayList<>();

        Timer.Context timerCtx = esMetricNamesQueryTimer.time();
        try {
            String response = elasticsearchRestHelper.fetchTokenDocuments(indexes, tenantId, query);

            List<MetricName> metricNames = getMetricNames(response);
            Set<MetricName> uniqueMetricNames = new HashSet<>(metricNames);
            return new ArrayList<>(uniqueMetricNames);
        } catch (IOException e) {
            log.error("IOException: Elasticsearch token query failed for tenantId {}. {}", tenantId, e.getMessage());
            throw new RuntimeException(String.format("searchESByIndexes failed with message: %s", e.getMessage()), e);
        } catch (Exception e) {
            log.error("Exception: Elasticsearch token query failed for tenantId {}. {}", tenantId, e.getMessage());
            throw new RuntimeException(String.format("searchESByIndexes failed with message: %s", e.getMessage()), e);
        } finally {
            timerCtx.stop();
        }
    }
private List < MetricName > searchESByIndexes ( String tenantId , String query , String [ ] indexes ) { if ( StringUtils . isEmpty ( query ) ) return new ArrayList <> ( ) ; Timer . Context timerCtx = esMetricNamesQueryTimer . time ( ) ; try { String response = elasticsearchRestHelper . fetchTokenDocuments ( indexes , tenantId , query ) ; List < MetricName > metricNames = getMetricNames ( response ) ; Set < MetricName > uniqueMetricNames = new HashSet <> ( metricNames ) ; return new ArrayList <> ( uniqueMetricNames ) ; } catch ( IOException e ) { log . error ( "IOException: Elasticsearch token query failed for tenantId {}. {}" , tenantId , e . getMessage ( ) ) ; throw new RuntimeException ( String . format ( "searchESByIndexes failed with message: %s" , e . getMessage ( ) ) , e ) ; } catch ( Exception e ) { log . error ( "Exception: Elasticsearch token query failed for tenantId {}. {}" , tenantId , e . getMessage ( ) ) ; throw new RuntimeException ( String . format ( "searchESByIndexes failed with message: %s" , e . getMessage ( ) ) , e ) ; } finally { timerCtx . stop ( ) ; } }
This method queries elasticsearch for a given glob query and returns list of {@link MetricName}'s.

@param tenantId
@param query is glob
@param indexes
@return
This method queries elasticsearch for a given glob query and returns list of { @link MetricName } s .