它应该在 Hits[i].Version
中,但当我查看 ISearchResponse
时它始终为 null。
我还在 ConnectionSettings
对象上设置了 .EnableMetrics
,但没有成功,因为版本始终为 null。
我仔细检查了 ElasticSearch,其中的文档版本正在递增。
请问有没有人使用 Nest 成功查看文档版本?
最佳答案
[Test]
public void WithVersion()
{
var queryResults = this.Client.Search<ElasticsearchProject>(s=>s
.Version()
.MatchAll()
);
Assert.True(queryResults.IsValid);
Assert.Greater(queryResults.Total, 0);
Assert.True(queryResults.Hits.All(h => !h.Version.IsNullOrEmpty()));
}
关于c# - 使用 NEST 从何处获取 ElasticSearch 文档版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28547075/