class DistinctAction extends Action<DistinctRequest> {

    @Override
    public ActionResponse execute(DistinctRequest request) {
        SearchRequestBuilder query;
        try {
            query = getConnection().getClient()
                    .prepareSearch(ElasticsearchUtils.getIndices(request.getTable(), request))
                    .setIndicesOptions(Utils.indicesOptions());
            query.setQuery(new ElasticSearchQueryGenerator().genFilter(request.getFilters()))
                    .setSize(QUERY_SIZE)
                    .addAggregation(Utils.buildTermsAggregation(
                            request.getNesting(), Sets.newHashSet(), elasticsearchTuningConfig.getAggregationSize()));
        }
        catch (Exception e) {
            throw FoxtrotExceptions.queryCreationException(request, e);
        }

        try {
            SearchResponse response = query.execute()
                    .actionGet(getGetQueryTimeout());
            return getResponse(response, getParameter());
        }
        catch (ElasticsearchException e) {
            throw FoxtrotExceptions.createQueryExecutionException(request, e);
        }
    }

    public  DistinctAction(DistinctRequest parameter, AnalyticsLoader analyticsLoader);

}