gpt4 book ai didi

elasticsearch - aioes 'delete_by_query'方法不起作用

转载 作者:行者123 更新时间:2023-12-03 00:59:38 25 4
gpt4 key购买 nike

我的橡皮筋中有几个字,当我按“匹配”关键字搜索时会显示。

{
"took": 3,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.30685282,
"hits": [
{
"_index": "my_words_pack",
"_type": "work_g1",
"_id": "AVetfhx1AM1sow6PcrL0",
"_score": 0.30685282,
"_source": {
"keyword": "morteza"
}
}
]
}
}

但是当我想通过'_id'删除它们时,它找不到并显示此错误:
es.delete_by_query(index='my_words_pack', doc_type='work_g1' body={"query": {"match": {"_id": "AVetfhx1AM1sow6PcrL0"}}})
错误:
aioes.exception.NotFoundError: TransportError(404, '{"found":false,"_index":"my_words_pack","_type":"work_g1","_id":"_query","_version":1,"_shards":{"total":2,"successful":1,"failed":0}}')

最佳答案

Elasticsearch在2.0版中删除了按查询删除功能,并将其添加为plugin,如果要使用此功能,则必须安装该文件。

由于您已经具有文档ID,因此最好通过ID而不是查询来删除这些文档。我认为在Python扩展中执行此操作的方法是
es.delete(index="my_words_pack",doc_type="work_g1",id="AVetfhx1AM1sow6PcrL0")

关于elasticsearch - aioes 'delete_by_query'方法不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39953737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com