示例代码如下:
from elasticsearch import Elasticsearches = Elasticsearch("localhost:9200")es.update(index='test',doc_type='test1',id='1',body={'doc':{'username':'Tom'},'doc_as_upsert':True})如果没有
doc_as_upsert=true它,则在id不存在时会引发异常。此外,请确保您的数据包装在doc {}中。

示例代码如下:
from elasticsearch import Elasticsearches = Elasticsearch("localhost:9200")es.update(index='test',doc_type='test1',id='1',body={'doc':{'username':'Tom'},'doc_as_upsert':True})如果没有
doc_as_upsert=true它,则在id不存在时会引发异常。此外,请确保您的数据包装在doc {}中。