Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a49ba6e

Browse files
author
admin
committed
修改官方文档有一个demo的参数问题
1 parent e6b2330 commit a49ba6e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎document-apis/update-api.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
### Update API
3-
更新索引
43

54
有两种方式更新索引:
65
- 创建 `UpdateRequest`,通过client发送;
@@ -22,6 +21,8 @@ client.update(updateRequest).get();
2221

2322
#### 使用 `prepareUpdate()` 方法
2423

24+
> 这里官方的示例有问题,new Script()参数错误,所以一下代码是我自己写的(2017年11月10日)
25+
2526
```
2627
client.prepareUpdate("ttl", "doc", "1")
2728
.setScript(new Script("ctx._source.gender = \"male\"" ,ScriptService.ScriptType.INLINE, null, null))//脚本可以是本地文件存储的,如果使用文件存储的脚本,需要设置 ScriptService.ScriptType.FILE
@@ -37,7 +38,7 @@ client.prepareUpdate("ttl", "doc", "1")
3738

3839
#### Update by script
3940

40-
使用脚本更新文档
41+
使用脚本更新文档
4142

4243
```
4344
UpdateRequest updateRequest = new UpdateRequest("ttl", "doc", "1")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /