How to use "SQL(ROW_NUMBER())" as same as for ElasticSearch Query using C#?

We have implemented ElasticSearch in our product. Our experience with the ElasticSearch is really great and interesting. We are likely to use more and more in our website, but facing some issues in Development.
We have checked your website and other references, but couldn't find any solution. It'll be a really great if you provide us some help into it.
We are also implementing Pagination using ElasticSearch, but couldn't find any Identity Column in ElasticSearch same as SQL(ROW_NUMBER()).
So please help us, how can we get this type of result, which returns unique value in result. Primary Key concepts are not used as it is a non-relational database.

Elasticsearch does not have a concept of Identity Column similar to SQL(ROW_NUMBER()). At most documents has an id which can not be incremental (like in a SQL database).

There are a few options for implementing paginations, though:

  • Using From / Size. This is the easiest to implement, but you should be aware of the deep pagination issue.
  • Using Search After. It does not have the deep pagination issue, but also has a few limitations like being unable to jump freely to random pages.
  • Using Scroll. Which is similar to Search After, but it is stateful (so should not be used for user-ended requests).

Thanks for your reply.
We have create search functionality in E-Commerce site, and we have create one index in ElasticSearch.
It's having 2.5L record. It takes a long time when I run a C# MVC code.
Can you please guide me how we can get faster result using C# MVC?
Is there any way to sync fast and easily transfer data from SQL to Elasticsearch?

I am sorry but C# MVC is something that I am not familiar with.

You can use Logstash that will certainly save you quite some work compared to writing a custom application. But I can not guarantee it's going to be fast and easy, since this depends a lot on the context.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.