Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic search - search_after parameter

I read this doc to understand 'search_after' and have two question.

  1. I'm curious that where "tweet#654323" comes from. Is this one of document id or field data?
  2. When I added multiple parameter of search_after, Is that 'and' condition or 'or' condition?

    ex) "search_after": [1463538857, 5147821]

like image 708
J.Done Avatar asked Feb 08 '17 07:02

J.Done


People also ask

How do I get more than 10000 hits in Elasticsearch?

By default, you cannot use from and size to page through more than 10,000 hits. This limit is a safeguard set by the index. max_result_window index setting. If you need to page through more than 10,000 hits, use the search_after parameter instead.

How does Elasticsearch implement pagination?

The Simplest to Implement The simplest method of pagination uses the from and size parameters available in Elasticsearch's search API. By default, from is 0 and size is 10, meaning if you don't specify otherwise, Elasticsearch will return only the first ten results from your index.

What is deep pagination Elasticsearch?

Deep pagination is one of the top performance killers for your cluster. Deep pagination means to allow the user access to too many pages. You should never give your users access to all the pages of their search request.


1 Answers

  1. As mentioned in that doc, "tweet#654323" is the _uid value of the document, which is made up of the _type and the _id of the document.

  2. You need as many values in search_after as you have sort clauses and those values must be ordered the same way as in your sort clause. In "search_after": [1463538857, 5147821], it looks like you're sorting by a date field and some other id field.

like image 199
Val Avatar answered Sep 19 '22 12:09

Val