3
我在elasticsearch中記錄了帶有特定時間戳的索引記錄。我試圖更新記錄使用下面的代碼(在python):在更新elasticsearch中的索引時發生RequestError
from elasticsearch import Elasticsearch
from datetime import datetime
import pytz
es = Elasticsearch()
time = datetime.utcnow().replace(tzinfo=pytz.utc)
msg = {'_id': 1, 'text': 'Hello World'}
es.index(index='idx', doc_type='dtype', id=msg['_id'], body=msg, timestamp=time, ttl='30d')
msg['text'] = 'New Message'
es.update(index='idx', doc_type='dtype', id=msg['_id'], body=msg, timestamp=time, ttl='30d')
而且我收到以下錯誤:
RequestError: TransportError(400, u'ActionRequestValidationException[Validation Failed: 1: script or doc is missing;]')
可能是什麼相同的理由嗎?
嘿@mirchi,我希望我的回答對你有幫助。如果是這種情況,請不要忘記接受:) – Heschoon 2016-03-10 16:49:20
謝謝@heschoon。我不知道如何接受。 – 2016-03-12 02:46:23
接受一個問題,你必須點擊答案左邊的upvote/downvote箭頭下的綠色「V」。它「關閉」了問題,標誌着問題解決了。 – Heschoon 2016-03-13 19:34:34