我使用 Python api 從 elasticsearch 插入和獲取,版本是 8.3.2
data = [ { 'id': 1, 'Title': 'Live1'},{ 'id': 2, 'Title': 'Live2'},{ 'id': 3, 'Title': 'Live3'}]嘗試插入時出現 Not Found 錯誤,它在版本 7 中作業
from elasticsearch import Elasticsearch
client = Elasticsearch("http://user:password@localhost:9200")
for e in data:
client.index(index="movie_data", document=e, id=e['id'])
錯誤 >NotFoundError: NotFoundError(404, 'index_not_found_exception', "no such index [movie_data] and [action.auto_create_index] ([.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*]) doesn't match")
在我的 yaml 檔案中,我添加了這個action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
- 我的相關問題是當我嘗試
client.indices.get_mapping( 'movie_data' )
我有錯誤>TypeError: Positional arguments can't be used with Elasticsearch API methods. Instead only use keyword arguments.
uj5u.com熱心網友回復:
在您的action.auto_create_index串列中,您沒有,movie_data因此無法自動創建索引。
您可以添加它或完全洗掉該行。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/514335.html
標籤:Python弹性搜索
