Elasticsearch Scroll

前端 未结 4 1069
日久生厌
日久生厌 2020-12-30 06:09

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

4条回答
  •  [愿得一人]
    2020-12-30 06:13

    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.

提交回复
热议问题