【发布时间】:2019-09-06 18:49:31
【问题描述】:
我使用的是 Nest 6.5.4。我无法在索引中的特定文档上使用脚本执行更新。 我尝试了很多方法,但出现语法错误。 我的查询如下。
var clientProvider = new ElasticClientProvider();
var projectModel = new ProjectModel();
var res = clientProvider.Client.Update<ProjectModel>(projectModel, i => i
.Index("attachment_index")
.Type("attachments")
.Id(projectId)
.Script(script=>script.Source("ctx._source.fileInfo.fileViewCount= ctx._source.fileInfo.fileViewCount + 1"))
);
它抛出错误“更新描述符没有 Id 的定义” 在 Kibana 中尝试使用相同的查询
POST attachment_index/attachments/1/_update
{
"script": {
"source":"ctx._source.fileInfo.fileViewCount += 1"
}
}
我不知道哪里出错了。
【问题讨论】:
标签: elasticsearch nest elastic-stack