Gia*_*ini 3 .net c# elasticsearch asp.net-web-api nest
我已将我的代码移植到NEST 2.0和Elasticsearch 2.0
我需要找到一种方法来更新已存储到ES2中的文档
我正在使用部分对象技术:
elastic.Update<myDocumentType, myPartialDocumentType>(u => u
.Index(myIndexName)
.Id(id)
.Doc(
new myPartialDocumentType()
{
// set the fields to update here
})
.Refresh());
Run Code Online (Sandbox Code Playgroud)
如何使用NEST2做同样的事情?
Rob*_*Rob 14
你如何传递文档ID的方式改变了一点.
看起来像今天一样:
var updateResponse = client.Update<Document, DocumentPartial>(1, descriptor => descriptor
.Doc(new DocumentPartial
{
Title = "new title"
}));
Run Code Online (Sandbox Code Playgroud)
要么
var updateResponse = client.Update<Document, DocumentPartial>(DocumentPath<Document>.Id(1), descriptor => descriptor
.Doc(new DocumentPartial
{
Title = "new title"
}));
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你.
| 归档时间: |
|
| 查看次数: |
2835 次 |
| 最近记录: |