赞
踩
import sys
import json
import requests
from elasticsearch import Elasticsearch, helpers
host = 'ip'
port = '9200'
config = {'es_conf':[host, port]}
es = Elasticsearch(config['es_conf'])
# 自己选出要删除的字段数据,这里选中的是_id
id_l = ['1024']
body = {
"query": {
"terms": {
"_id": id_l
}
}
}
index_v = 'index_name'
url = 'http://%s:%s/%s/_delete_by_query'
res = requests.post(url=url % (host, port,index_v), json=body)
print('删除成功')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。