2.X/1. Getting Started

1-09. Distributed Search Execution

drscg 2017. 9. 30. 18:05

Before moving on, we are going to take a detour and talk about how search is executed in a distributed environment. It is a bit more complicated than the basic create-read-update-delete(CRUD) requests that we discussed in Distributed Document Store.

더 나아가기에 앞서, 분산 환경에서 검색을 실행하는 방법에 대해 이야기하려 한다. 이것은 Distributed Document Store에서 이야기했던, 기본적인 CRUD(create-read-update-delete) 보다 약간 더 복잡하다.

A CRUD operation deals with a single document that has a unique combination of _index_type, and routing values (which defaults to the document’s _id). This means that we know exactly which shard in the cluster holds that document.

CRUD 연산은 _index_type 그리고 routing values(이 값은 기본적으로 document의 _id 이다)의 유일한 조합을 가진, 단일 document를 다룬다. 즉, document가 cluster의 어느 shard에 있는지 정확히 알 수 있다.

Search requires a more complicated execution model because we don’t know which documents will match the query: they could be on any shard in the cluster. A search request has to consult a copy of every shard in the index or indices we’re interested in to see if they have any matching documents.

query에 어떤 document(cluster내의 어떤 shard에도 있을 수 있다)가 일치할지를 알지 못하기 때문에, 검색은 더 복잡한 실행 모델을 요구한다. 검색 request는 일치하는 document를 가지고 있는 shard를 알아내기 위해, index나 indices에 있는 모든 shard의 복사본을 찾아야 한다.

But finding all matching documents is only half the story. Results from multiple shards must be combined into a single sorted list before the search API can return a "page" of results. For this reason, search is executed in a two-phase process called query then fetch.

그러나, 일치하는 모든 document를 찾는 것이 전부가 아니다. search API가 결과의 한 "page"를 반환하기 전에, 여러 shard로부터의 결과를, 하나의 정렬된 목록으로 조합해야 한다. 이런 이유로, 검색은 query 그 다음에 fetch 라는 두 개의 프로세스로 실행된다.

'2.X > 1. Getting Started' 카테고리의 다른 글

1-08-3. What Is Relevance?  (0) 2017.09.30
1-08-4. Doc Values Intro  (0) 2017.09.30
1-09-1. Query Phase  (0) 2017.09.30
1-09-2. Fetch Phase  (0) 2017.09.30
1-09-3. Search Options  (0) 2017.09.30