I am little bit confused over Elasticsearch by its scroll functionality. In elasticsearch is it possible to call search API everytime whenever the user scrolls on the result
What you described as an example use case is actually search results pagination, which is available for any search query and is limited by 10k results. scroll
requests are needed for the cases when you need to go over that 10k limit, with scroll
query you can fetch even the entire collection of documents.
Probably the source of confusion here is that scroll
term is ambiguous: it means the type of a query, and also it is a name of a parameter of such query (as was mentioned in other comments, it is time ES will keep waiting for you to fetch next chunk of scrolling).
scroll
queries are heavy, and should be avoided until absolutely necessary. In fact, in the docs
it says:
Scrolling is not intended for real time user requests, but rather for processing large amounts of data, ...
Now regarding your another question:
In elasticsearch is it possible to call search API everytime whenever the user scrolls on the result set?
Yes, even several parallel scroll requests are possible:
Each scroll is independent and can be processed in parallel like any scroll request.