def hit_count(result):
    """ Parse the hit count from an ElasticSearch response
        ES7: result['hits']['total']['value'], ES6: result['hits']['total']"""

    return result['hits']['total']['value'] \
        if type(result['hits']['total']) is dict \
        else result['hits']['total']