if len(ids) > 0:
    return
bulk_body = ['{{"delete": {{"_index": "{}", "_type": "{}", "_id": "{}"}}}}'
    .format(index, type_, x) for x in ids]
es.bulk('\n'.join(bulk_body))
How to delete documents from Elasticsearch