Home > Articles > Details

nest - ElasticSearch Order By String

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


Please 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)
                          .Size(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.


© 2022 - ErnesTech - Privacy