2014年7月2日 星期三

[elasticsearch]deep paging problems


再次談到 search engine 的 deep page problems。

當你要取得 1001個分頁的資料時,Elasticsearch 幫你做了什麼是呢?
(假設每個分頁有 10筆)


  • requested node 接收到 query string 
  • 每個 shard 會執行從 requested node 來的 query string,取得 hit 的 doc ID 與 sort 的欄位值。所以說,每個 shard 上會有  local sorted priority queue。 (預設是 by "relevance score” The relevance score of each document is represented by a positive floating point number called the _score — the higher the _score, the more relevant the document.)
  • 每個 shard 把  local sorted priority queue 送到 requested node 做 sort by score。所以,這裡會取得 shard_num*10010 筆 doc ID 與 score pair。 並且取出 10000 ~ 100010 的 doc IDs。
  • requested node 使用 doc IDs 去取回該 doc 的 document 內容。

cf.
What is relevance? http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/relevance-intro.html





沒有留言:

張貼留言