2014年6月6日 星期五

[elasticsearch]search type - count 數量統計


elasticsearch 在使用情境上提供了多樣的 "search type" 可以使用。

search type 

在分散式的搜尋引擎設計中,在search 時,有時想要不同的面向的result。像是,單純想要知道count的數值,想要知道這個query 有多少hits,但是並不關心 docs

_search?search_type=count

There are different execution paths that can be done when executing a distributed search. The distributed search operation needs to be scattered to all the relevant shards and then all the results are gathered back. When doing scatter/gather type execution, there are several ways to do that, specifically with search engines.

One of the questions when executing a distributed search is how much results to retrieve from each shard. For example, if we have 10 shards, the 1st shard might hold the most relevant results from 0 till 10, with other shards results ranking below it. For this reason, when executing a request, we will need to get results from 0 till 10 from all shards, sort them, and then return the results if we want to ensure correct results.

沒有留言:

張貼留言