c# - 使用 NEST 从何处获取 ElasticSearch 文档版本

标签 c# elasticsearch nest

它应该在 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/

相关文章:

elasticsearch - 在Solr 5.3.1中替换ApostropheFilterFactory

regex - 如何正确使用elasticsearch正则表达式查询?

elasticsearch - NEST试图将枚举转换为字符串

Elasticsearch 嵌套 : ordering terms aggregation with multiple criteria

c# - LINQ 复杂查询导航属性

elasticsearch - 多个(AND)查询Elasticsearch中的嵌套索引结构

c# - 如何使用 Winforms 或 WPF 构建表单完成/文档合并应用程序?

azure - 在 Web 应用程序中将 Nest Elasticsearch 与 Azure 结合使用

c# - 从 Linq 中的另一个列表项创建列表

c# - 如何检查两个图像是否相同