def query_es_for_unique(config):
    now = datetime.utcnow()
    es = Elasticsearch(**config['elasticsearch'])
    unique = {'Xbox': [], 'Playstation': []}
    unique_count_query['query']['bool']['must'][(- 1)]['range']['date']['lte'] = now.strftime('%Y-%m-%d')
    for earliest in config['unique']:
        unique_count_query['query']['bool']['must'][(- 1)]['range']['date']['gte'] = (now - timedelta(days=earliest)).strftime('%Y-%m-%d')
        results = es.search(index=config['battle index'], body=unique_count_query)
        for bucket in results['aggregations']['2']['buckets']:
            if (bucket['key'] == 'xbox'):
                unique['Xbox'].append(bucket['1']['value'])
            else:
                unique['Playstation'].append(bucket['1']['value'])
    return unique
def query_es_for_unique(config):
    now = datetime.utcnow()
    es = Elasticsearch(**config['elasticsearch'])
    unique = {'Xbox': [], 'Playstation': []}
    unique_count_query['query']['bool']['must'][(- 1)]['range']['date']['lte'] = now.strftime('%Y-%m-%d')
    for earliest in config['unique']:
        unique_count_query['query']['bool']['must'][(- 1)]['range']['date']['gte'] = (now - timedelta(days=earliest)).strftime('%Y-%m-%d')
        results = es.search(index=config['battle index'], body=unique_count_query)
        for bucket in results['aggregations']['2']['buckets']:
            if (bucket['key'] == 'xbox'):
                unique['Xbox'].append(bucket['1']['value'])
            else:
                unique['Playstation'].append(bucket['1']['value'])
    return unique