def query_five_battles_a_day_minimum(config):
    now = datetime.utcnow()
    then = (now - timedelta(days=config['days']))
    es = Elasticsearch(**config['elasticsearch'])
    five_battles_a_day_query['query']['bool']['must'][(- 1)]['range']['date']['lte'] = now.strftime('%Y-%m-%d')
    five_battles_a_day_query['query']['bool']['must'][(- 1)]['range']['date']['gte'] = then.strftime('%Y-%m-%d')
    response = es.search(index=config['battle index'], body=five_battles_a_day_query)
    buckets = {'xbox': OrderedDict(), 'ps': OrderedDict(), 'all': OrderedDict()}
    for bucket in response['aggregations']['4']['buckets']:
        key = bucket['key_as_string'].split('T')[0]
        buckets['xbox'][key] = 0
        buckets['ps'][key] = 0
        buckets['all'][key] = 0
        for subbucket in bucket['3']['buckets']:
            buckets[subbucket['key']][key] = subbucket['2']['buckets']['5.0-*']['doc_count']
        buckets['all'][key] = (buckets['xbox'][key] + buckets['ps'][key])
    return buckets
def query_five_battles_a_day_minimum(config):
    now = datetime.utcnow()
    then = (now - timedelta(days=config['days']))
    es = Elasticsearch(**config['elasticsearch'])
    five_battles_a_day_query['query']['bool']['must'][(- 1)]['range']['date']['lte'] = now.strftime('%Y-%m-%d')
    five_battles_a_day_query['query']['bool']['must'][(- 1)]['range']['date']['gte'] = then.strftime('%Y-%m-%d')
    response = es.search(index=config['battle index'], body=five_battles_a_day_query)
    buckets = {'xbox': OrderedDict(), 'ps': OrderedDict(), 'all': OrderedDict()}
    for bucket in response['aggregations']['4']['buckets']:
        key = bucket['key_as_string'].split('T')[0]
        buckets['xbox'][key] = 0
        buckets['ps'][key] = 0
        buckets['all'][key] = 0
        for subbucket in bucket['3']['buckets']:
            buckets[subbucket['key']][key] = subbucket['2']['buckets']['5.0-*']['doc_count']
        buckets['all'][key] = (buckets['xbox'][key] + buckets['ps'][key])
    return buckets