nest - ElasticSearch Order By String

Question: How do you order by Date in Elasticsearch Nest C# API.

Login to See the Rest of the Answer

Answer: See the code below

var  response = await _elasticClient.SearchAsync<MyIndex>
                      s => s.Query(q => q.QueryString(d => d.Query("Technology")))
                      .Sort(a => a.Descending(b => b.DateInserted))
                          .From((page - 1) * pageSize)


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

© 2023 - ErnesTech LLC- Privacy