body = {
"query": {
"term": {
"厂家": "test"
}
}
}
print(es.search(index=product_index, body=body))
print(es.delete_by_query(index=product_index, doc_type='comp', body=body))
操作如上:显示结果如下:
{'took': 2, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'failed': 0}, 'hits': {'total': 3, 'max_score': 8.75126, 'hits': [{'_index': 'test', '_type': 'comp', '_id': 'AWQ2ZpopYniBlYUIndBa', '_score': 8.75126, '_source': {'厂家': 'test', '类型': '无'}}, {'_index': 'test', '_type': 'comp', '_id': 'AWQ2ZsAEYniBlYUIndBb', '_score': 8.359892, '_source': {'厂家': 'test', '类型': '无'}}, {'_index': 'test', '_type': 'comp', '_id': 'AWQ2xNl0YniBlYUIndBf', '_score': 8.359892, '_source': {'厂家': 'test', '类型': '无'}}]}}
{'_index': 'test', '_type': 'comp', '_id': '_delete_by_query', '_version': 23, '_shards': {'total': 1, 'successful': 1, 'failed': 0}, 'created': False}
在head中查看数据不能被删除,请教大家,麻烦了。
1 个回复
wangchonglie
赞同来自: