如何在NEST2中更新Elasticsearch文档
我已将我的代码移植到NEST 2.0和Elasticsearch 2.0
我需要找到一种方法来更新已存储到ES2中的文档
我正在使用部分对象技术 :
elastic.Update(u => u .Index(myIndexName) .Id(id) .Doc( new myPartialDocumentType() { // set the fields to update here }) .Refresh());
如何使用NEST2做同样的事情?
您如何传递文档ID的方式有所改变。
看起来像今天一样:
var updateResponse = client.Update(1, descriptor => descriptor .Doc(new DocumentPartial { Title = "new title" }));
要么
var updateResponse = client.Update(DocumentPath.Id(1), descriptor => descriptor .Doc(new DocumentPartial { Title = "new title" }));
希望能帮助到你。