Chrysalis
Chrysalis

Reputation: 4220

Elasticsearch range query option for C#/.net consumer

I am using Nest to query elasticsearch to fetch a list of documents that belong in a certain date range. This is what I have but I am not sure how to change it to provide date range.

var searchResults = elasticSearchClient
    .Search<Product>(s => s.From(0)
        .Size(10)
        .Query(q => q.Term(p => p.SellDate.....)));

I want to filter results so that I get the data with "SellDate" in the last 24 hours.

Upvotes: 0

Views: 630

Answers (1)

BLoB
BLoB

Reputation: 9725

Something like the following:

q => q.Range(v => v.OnField("myDocs.SellDate").From(fromRange).To(toRange))

Upvotes: 1

Related Questions