class BookingDaoESImp extends BaseDaoESImp implements BookingDao {

    @Override
    public BookingBucket getMaxBookingBucketPriority(String day) throws IOException
    {
        /**
         * Make sure day is in right format
         */
        day = day.replace("-", "");

        BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
        append(boolQueryBuilder, Arrays.asList(new String[]{day}), "day");
        SearchSourceBuilder sourceBuilder = new SearchSourceBuilder().query(boolQueryBuilder).size(0);

        TopHitsAggregationBuilder topHitsAggregationBuilder = new TopHitsAggregationBuilder("doc_with_max_priority");
        topHitsAggregationBuilder.size(1).sort("priority", SortOrder.DESC);
        sourceBuilder = sourceBuilder.aggregation(topHitsAggregationBuilder);

        SearchRequest searchRequest = new SearchRequest(this.bookingBucketsIndex);
        searchRequest.source(sourceBuilder);
        ESResponse esResponse = esclient.search(searchRequest);

        BookingBucket result = null;
        Object obj = ((Map) (((Map) (esResponse.getSourceMap().get("top_hits#doc_with_max_priority"))).get("hits"))).get("hits");
        List<Object> bbList = (List<Object>) obj;
        if (bbList.size() > 0)
        {
            Map bbMap = (Map) bbList.get(0);
            result = buildBookingBucket(bbMap);
        }

        return result;
    }

    public  BookingDaoESImp();
    public  BookingDaoESImp(Properties properties);

}