python es 删除数据

python脚本删除es 数据

附代码

   from Elasticsearch import Elasticsearch
    host = '20.0.0.11:9200'
    es = Elasticsearch([host])
    query = {'query': {'match': {'url': 'http://stats.tj.gov.cn/TJTJJ434/JJXX602/202010/t20201026_4001686.html'}}}  # 删除url = http://stats.tj.gov.cn/TJTJJ434/JJXX602/202010/t20201026_4001686.html
    es.delete_by_query(index='guoyan_index_v1', body=query, doc_type='guoyan_index_v1')

 

posted @ 2020-12-29 17:47  淋哥  阅读(2063)  评论(0编辑  收藏  举报