response = es.search(index=index, filter_path=['hits.hits._id'], body={
    'size': count, 'query': {'filtered': {'filter': {'type': {'value':
    type_}}}}})
ids = [x['_id'] for x in response['hits']['hits']]
if len(ids) > 0:
    pass
How to delete documents from Elasticsearch