gpt4 book ai didi

python-3.x - Elasticsearch中的删除索引

转载 作者:行者123 更新时间:2023-12-02 22:23:17 30 4
gpt4 key购买 nike

我想删除我使用python笔记本中的以下代码创建的 flex 搜索的整个索引。

es.index(index='para', doc_type='people', id=1, body={
"name":"Farid ullah",
"height":"160",
"age":"23",
"gender":"male",
"date of birth":"04/02/1994",
"Qualification":"BS in Software engineering"

})

delete命令如下:
es.delete(index='para', doc_type='people')
但我收到以下错误
TypeError                                 Traceback (most recent call last)
<ipython-input-7-26c24345ae23> in <module>()
----> 1 es.delete(index='para', doc_type='people')

C:\Users\Farid ullah\Anaconda3\lib\site-packages\elasticsearch\client\utils.py in _wrapped(*args, **kwargs)
71 if p in kwargs:
72 params[p] = kwargs.pop(p)
---> 73 return func(*args, params=params, **kwargs)
74 return _wrapped
75 return _wrapper

TypeError: delete() missing 1 required positional argument: 'id'

我不能删除整个索引吗?
有什么方法可以在不指定特定ID的情况下将其删除?

最佳答案

在您的情况下,“people”不是索引,而是一种类型。索引名称是“para”。
我不知道python API,但您应该尝试类似的方法:

es.delete(index='para')

在此文档中:
http://elasticsearch-py.readthedocs.io/en/master/api.html

建议使用类似:
es.indices.delete(index='para')

关于python-3.x - Elasticsearch中的删除索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43135176/

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