How to update a document using elasticsearch-py?

后端 未结 1 737
暖寄归人
暖寄归人 2020-12-13 23:57

Does anyone have an example for how to use update? It\'s documented here, but the documentation is unclear and doesn\'t include a working example. I\'ve tried the followin

相关标签:
1条回答
  • 2020-12-14 00:52

    You're almost there, you just need to enclose your body inside a "doc" field. The correct way of doing a partial update with elasticsearch-py goes like this:

    coll = Elasticsearch()
    coll.update(index='stories-test',doc_type='news',id=hit.meta.id,
                    body={"doc": {"stanford": 1, "parsed_sents": parsed }})
    
    0 讨论(0)
提交回复
热议问题