2.X/1. Getting Started

1-09-2. Fetch Phase

drscg 2017. 9. 30. 18:00

The query phase identifies which documents satisfy the search request, but we still need to retrieve the documents themselves. This is the job of the fetch phase, shown in Figure 15, “분산 검색의 fetch 절”.

query 절은 어떤 document가 검색 request를 만족하는지를 확인할 뿐이다. 이제 document 자체를 가져와야 한다. 이것이, Figure 15, “분산 검색의 fetch 절”에서 보이는 fetch 절의 역할이다.

Figure 15. 분산 검색의 fetch 절

분산 검색의 fetch 절


The distributed phase consists of the following steps:

fetch 절은 다음과 같은 단계로 구성된다.

  1. The coordinating node identifies which documents need to be fetched and issues a multi GETrequest to the relevant shards.

    조정(coordinating) node는 가져올(be fetched) document를 확인하고, 관련 shard에 다중 GETrequest를 요청한다.

  2. Each shard loads the documents and enriches them, if required, and then returns the documents to the coordinating node.

    각 shard는 document와 request한 metadata등을 가져와, 조정 node로 반환한다.

  3. Once all documents have been fetched, the coordinating node returns the results to the client.

    모든 document를 가져오면, 조정(coordinating) node는 결과를 클라이언트로 반환한다.

The coordinating node first decides which documents actually need to be fetched. For instance, if our query specified { "from": 90, "size": 10 }, the first 90 results would be discarded and only the next 10 results would need to be retrieved. These documents may come from one, some, or all of the shards involved in the original search request.

먼저, 조정 node는 실제로 가져와야 할 document가 어떤 것인지를, 결정한다. 예를 들어, query가 { "from": 90, "size": 10 } 이라면, 처음 90개는 버리고, 그 다음 10개만 가져와야 한다. 이들 document는 원래의 검색 request에 포함되는, 하나 이상 또는 모든 shard로부터 가져올 수 있다.

The coordinating node builds a multi-get request for each shard that holds a pertinent document and sends the request to the same shard copy that handled the query phase.

조정 node는 관련된 document를 가지고 있는 각 shard에 대해, multi-get request를 생성하고, query 절이 처리된, 동일한 shard의 복사본으로 request를 전송한다.

The shard loads the document bodies—the _source field—and, if requested, enriches the results with metadata and search snippet highlighting. Once the coordinating node receives all results, it assembles them into a single response that it returns to the client.

shard는 document의 body(_source field), 필요하다면, metadata와 highlight 정보 등을 로드한다. 조정 node가 모든 결과를 받으면, 그것들을 하나의 response으로 조합하고, 클라이언트로 반환한다.


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

1-09. Distributed Search Execution  (0) 2017.09.30
1-09-1. Query Phase  (0) 2017.09.30
1-09-3. Search Options  (0) 2017.09.30
1-09-4. Scroll  (0) 2017.09.30
1-10. Index Management  (0) 2017.09.30