doc_update
Update specific documents in an Easysearch index using partial field updates or script-based modifications, with options to insert new documents when needed.
Instructions
更新文档
参数:
index: 索引名称
id: 文档 ID
doc: 部分更新的字段
script: 脚本更新
upsert: 文档不存在时插入的内容
refresh: 刷新策略
示例 - 部分更新:
doc_update("products", "1", doc={"price": 899})
示例 - 脚本更新:
doc_update("products", "1", script={
"source": "ctx._source.price -= params.discount",
"params": {"discount": 100}
})
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | ||
| id | Yes | ||
| doc | No | ||
| script | No | ||
| upsert | No | ||
| refresh | No |