简体   繁体   中英

Where to get ElasticSearch document version using NEST

It should be in the Hits[i].Version but that is always null when I look at the ISearchResponse .

I've also set the .EnableMetrics on the ConnectionSettings object but no luck as the version is always null.

I have double checked ElasticSearch and the document versions are incrementing fine in there.

So has anyone successfully managed to view the document version please using 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()));
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM