Profile API (프로파일 API)
Profile API는 검색 요청의 개별 구성 요소 실행에 대한 타이밍 정보를 제공하는 API예요. Profile API를 사용하면 느린 요청을 디버깅하고 성능을 어떻게 개선할 수 있는지 파악할 수 있습니다. 단, Profile API는 다음 항목은 측정하지 않습니다.
- 네트워크 지연
- 검색 fetch 단계에서 보낸 시간
- 요청이 큐에서 보낸 시간
- 코디네이팅 노드에서 샤드 응답을 병합하는 동안의 유휴 시간
Profile API는 검색 작업에 오버헤드를 추가하는 리소스 소모가 큰 작업이에요.
출처: OpenSearch 문서
본문
Endpoints
GET /testindex/_search { "profile" : true , "query" : { "match" : { "title" : "wind" } } }
Concurrent segment search
OpenSearch 2.12부터 동시 세그먼트 검색(concurrent segment search)은 쿼리 단계에서 각 샤드 레벨 요청이 세그먼트를 병렬로 검색할 수 있게 합니다. Profile API 응답에는 *슬라이스(slice)*에 대한 통계가 담긴 몇 가지 추가 필드가 포함됩니다.
슬라이스는 스레드가 실행할 수 있는 작업의 단위예요. 각 쿼리는 여러 슬라이스로 분할될 수 있으며, 각 슬라이스에는 하나 이상의 세그먼트가 들어 있습니다. 모든 슬라이스는 풀의 가용 스레드에 따라 병렬로 또는 어떤 순서로든 실행될 수 있습니다.
일반적으로 max/min/avg 슬라이스 시간은 특정 타이밍 유형에 대해 모든 슬라이스에 걸친 통계를 캡처합니다. 예를 들어 애그리게이션을 프로파일링할 때 aggregations 섹션의 max_slice_time_in_nanos 필드는 모든 슬라이스에 걸쳐 애그리게이션 작업과 그 하위 작업이 소비한 최대 시간을 보여줍니다.
Example requests
Non-concurrent search
Profile API를 사용하려면 _search 엔드포인트로 보내는 검색 요청에 profile 파라미터를 true로 설정해 포함하면 됩니다.
GET /testindex/_search { "profile" : true , "query" : { "match" : { "title" : "wind" } } }
response = client . search ( index = " testindex " , body = { " profile " : true , " query " : { " match " : { " title " : " wind " } } } )
사람이 읽기 좋은 형식으로 보려면 요청에 ?human=true 쿼리 파라미터를 포함하세요.
GET /testindex/_search?human= true { "profile" : true , "query" : { "match" : { "title" : "wind" } } }
response = client . search ( index = " testindex " , params = { " human " : " true " }, body = { " profile " : true , " query " : { " match " : { " title " : " wind " } } } )
응답에는 사람이 읽을 수 있는 단위의 추가 time 필드가 포함됩니다. 예를 들면 다음과 같습니다.
"collector" : [ { "name" : "SimpleTopScoreDocCollector" , "reason" : "search_top_hits" , "time" : "113.7micros" , "time_in_nanos" : 113711 } ]
Profile API 응답은 장황하므로 curl 명령으로 실행한다면 응답을 이해하기 쉽게 ?pretty 쿼리 파라미터를 포함하세요.
Aggregations
애그리게이션을 프로파일링하려면 애그리게이션 요청을 보내고 profile 파라미터를 true로 설정하면 됩니다.
Global aggregation
GET /opensearch_dashboards_sample_data_ecommerce/_search { "profile" : "true" , "size" : 0 , "query" : { "match" : { "manufacturer" : "Elitelligence" } }, "aggs" : { "all_products" : { "global" : {}, "aggs" : { "avg_price" : { "avg" : { "field" : "taxful_total_price" } } } }, "elitelligence_products" : { "avg" : { "field" : "taxful_total_price" } } } }
response = client . search ( index = " opensearch_dashboards_sample_data_ecommerce " , body = { " profile " : " true " , " size " : 0 , " query " : { " match " : { " manufacturer " : " Elitelligence " } }, " aggs " : { " all_products " : { " global " : {}, " aggs " : { " avg_price " : { " avg " : { " field " : " taxful_total_price " } } } }, " elitelligence_products " : { " avg " : { " field " : " taxful_total_price " } } } } )
Non-global aggregation
GET /opensearch_dashboards_sample_data_ecommerce/_search { "size" : 0 , "aggs" : { "avg_taxful_total_price" : { "avg" : { "field" : "taxful_total_price" } } } }
response = client . search ( index = " opensearch_dashboards_sample_data_ecommerce " , body = { " size " : 0 , " aggs " : { " avg_taxful_total_price " : { " avg " : { " field " : " taxful_total_price " } } } } )
Example response
Non-concurrent search
응답에는 프로파일링 정보가 포함됩니다.
Response
{ "took" : 21 , "timed_out" : false , "_shards" : { "total" : 1 , "successful" : 1 , "skipped" : 0 , "failed" : 0 }, "hits" : { "total" : { "value" : 2 , "relation" : "eq" }, "max_score" : 0.19363807 , "hits" : [ { "_index" : "testindex" , "_id" : "1" , "_score" : 0.19363807 , "_source" : { "title" : "The wind rises" } }, { "_index" : "testindex" , "_id" : "2" , "_score" : 0.17225474 , "_source" : { "title" : "Gone with the wind" , "description" : "A 1939 American epic historical film" } } ] }, "profile" : { "shards" : [ { "id" : "[LidyZ1HVS-u93-73Z49dQg][testindex][0]" , "inbound_network_time_in_millis" : 0 , "outbound_network_time_in_millis" : 0 , "searches" : [ { "query" : [ { "type" : "BooleanQuery" , "description" : "title:wind title:rise" , "time_in_nanos" : 2473919 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 5209 , "match" : 0 , "next_doc_count" : 2 , "score_count" : 2 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 9209 , "advance_count" : 2 , "score" : 20751 , "build_scorer_count" : 4 , "create_weight" : 1404458 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 1034292 }, "children" : [ { "type" : "TermQuery" , "description" : "title:wind" , "time_in_nanos" : 813581 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 3291 , "match" : 0 , "next_doc_count" : 2 , "score_count" : 2 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 7208 , "advance_count" : 2 , "score" : 18666 , "build_scorer_count" : 6 , "create_weight" : 616375 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 168041 } }, { "type" : "TermQuery" , "description" : "title:rise" , "time_in_nanos" : 191083 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 0 , "match" : 0 , "next_doc_count" : 0 , "score_count" : 0 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 0 , "advance_count" : 0 , "score" : 0 , "build_scorer_count" : 2 , "create_weight" : 188625 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 2458 } } ] } ], "rewrite_time" : 192417 , "collector" : [ { "name" : "SimpleTopScoreDocCollector" , "reason" : "search_top_hits" , "time_in_nanos" : 77291 } ] } ], "aggregations" : [] } ] } }
Concurrent segment search
다음은 세 개의 세그먼트 슬라이스가 있는 동시 세그먼트 검색에 대한 예제 응답입니다.
Response
{ "took" : 10 , "timed_out" : false , "_shards" : { "total" : 1 , "successful" : 1 , "skipped" : 0 , "failed" : 0 }, "hits" : { "total" : { "value" : 5 , "relation" : "eq" }, "max_score" : 1.0 , "hits" : [ ... ] }, "aggregations" : { ... }, "profile" : { "shards" : [ { "id" : "[9Y7lbpaWRhyr5Y-41Zl48g][idx][0]" , "inbound_network_time_in_millis" : 0 , "outbound_network_time_in_millis" : 0 , "searches" : [ { "query" : [ { "type" : "MatchAllDocsQuery" , "description" : "*:*" , "time_in_nanos" : 868000 , "max_slice_time_in_nanos" : 19376 , "min_slice_time_in_nanos" : 12250 , "avg_slice_time_in_nanos" : 16847 , "breakdown" : { "max_match" : 0 , "set_min_competitive_score_count" : 0 , "match_count" : 0 , "avg_score_count" : 1 , "shallow_advance_count" : 0 , "next_doc" : 29708 , "min_build_scorer" : 3125 , "score_count" : 5 , "compute_max_score_count" : 0 , "advance" : 0 , "min_set_min_competitive_score" : 0 , "min_advance" : 0 , "score" : 29250 , "avg_set_min_competitive_score_count" : 0 , "min_match_count" : 0 , "avg_score" : 333 , "max_next_doc_count" : 3 , "max_compute_max_score_count" : 0 , "avg_shallow_advance" : 0 , "max_shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "min_build_scorer_count" : 2 , "next_doc_count" : 8 , "min_match" : 0 , "avg_next_doc" : 888 , "compute_max_score" : 0 , "min_set_min_competitive_score_count" : 0 , "max_build_scorer" : 5791 , "avg_match_count" : 0 , "avg_advance" : 0 , "build_scorer_count" : 6 , "avg_build_scorer_count" : 2 , "min_next_doc_count" : 2 , "min_shallow_advance_count" : 0 , "max_score_count" : 2 , "avg_match" : 0 , "avg_compute_max_score" : 0 , "max_advance" : 0 , "avg_shallow_advance_count" : 0 , "avg_set_min_competitive_score" : 0 , "avg_compute_max_score_count" : 0 , "avg_build_scorer" : 4027 , "max_set_min_competitive_score_count" : 0 , "advance_count" : 0 , "max_build_scorer_count" : 2 , "shallow_advance" : 0 , "min_compute_max_score" : 0 , "max_match_count" : 0 , "create_weight_count" : 1 , "build_sco... [truncated]
Response body fields
응답에는 다음 필드들이 포함됩니다.
| Field | Data type | Description |
|---|---|---|
profile |
Object | Contains profiling information. |
profile.shards |
Array of objects | A search request can be executed against one or more shards in the index, and a search may involve one or more indexes. Thus, the profile.shards array contains profiling information for each shard that was involved in the search. |
profile.shards.id |
String | The shard ID of the shard in the [node-ID][index-name][shard-ID] format. |
profile.shards.searches |
Array of objects | A search represents a query executed against the underlying Lucene index. Most search requests execute a single search against a Lucene index, but some search requests can execute more than one search. For example, including a global aggregation results in a secondary match_all query for the global context. The profile.shards array contains profiling information about each search execution. |
profile.shards.searches.query |
Array of objects | Profiling information about the query execution. |
profile.shards.searches.rewrite_time |
Integer | All Lucene queries are rewritten. A query and its children may be rewritten more than once, until the query stops changing. The rewriting process involves performing optimizations, such as removing redundant clauses or replacing a query path with a more efficient one. After the rewriting process, the original query may change significantly. The rewrite_time field contains the cumulative total rewrite time for the query and all its children, in nanoseconds. |
profile.shards.searches.collector |
Array of objects | Profiling information about the Lucene collectors that ran the search. |
profile.shards.aggregations |
Array of objects | Profiling information about the aggregation execution. |
The query array
query 배열에는 다음 필드들이 있는 객체가 포함됩니다.
| Field | Data type | Description |
|---|---|---|
type |
String | The Lucene query type into which the search query was rewritten. Corresponds to the Lucene class name (which often has the same name in OpenSearch). |
description |
String | Contains a Lucene explanation of the query. Helps differentiate queries with the same type. |
time_in_nanos |
Long | The total elapsed time for this query, in nanoseconds. For concurrent segment search, time_in_nanos is the total time spent across all the slices (the difference between the last completed slice execution end time and the first slice execution start time). |
max_slice_time_in_nanos |
Long | The maximum amount of time taken by any slice to run a query, in nanoseconds. This field is included only if you enable concurrent segment search. |
min_slice_time_in_nanos |
Long | The minimum amount of time taken by any slice to run a query, in nanoseconds. This field is included only if you enable concurrent segment search. |
avg_slice_time_in_nanos |
Long | The average amount of time taken by any slice to run a query, in nanoseconds. This field is included only if you enable concurrent segment search. |
breakdown |
Object | Contains timing statistics about low-level Lucene execution. |
children |
Array of objects | If a query has subqueries (children), this field contains information about the subqueries. |
The breakdown object
breakdown 객체는 저수준 Lucene 실행에 대한 타이밍 통계를 메서드별로 나타냅니다. 타이밍은 벽시계(wall-clock) 나노초로 표시되며 정규화되지 않습니다. breakdown 타이밍은 모든 하위 시간을 포함합니다. breakdown 객체는 다음 필드들로 구성됩니다. 모든 필드는 정수 값을 포함합니다.
| Field | Description |
|---|---|
create_weight |
A Query object in Lucene is immutable. Yet, Lucene should be able to reuse Query objects in multiple IndexSearcher objects. Thus, Query objects need to keep temporary state and statistics associated with the index in which the query is executed. To achieve reuse, every Query object generates a Weight object, which keeps the temporary context (state) associated with the <IndexSearcher, Query> tuple. The create_weight field contains the amount of time spent creating the Weight object. |
build_scorer |
A Scorer iterates over matching documents and generates a score for each document. The build_scorer field contains the amount of time spent generating the Scorer object. This does not include the time spent scoring the documents. The Scorer initialization time depends on the optimization and complexity of a particular query. The build_scorer parameter also includes the amount of time associated with caching, if caching is applicable and enabled for the query. |
next_doc |
The next_doc Lucene method returns the document ID of the next document that matches the query. This method is a special type of the advance method and is equivalent to advance(docId() + 1). The next_doc method is more convenient for many Lucene queries. The next_doc field contains the amount of time required to determine the next matching document, which varies depending on the query type. |
advance |
The advance method is a lower-level version of the next_doc method in Lucene. It also finds the next matching document but necessitates that the calling query perform additional tasks, such as identifying skips. Some queries, such as conjunctions (must clauses in Boolean queries), cannot use next_doc. For those queries, advance is timed. |
match |
For some queries, document matching is performed in two steps. First, the document is matched approximately. Second, those documents that are approximately matched are examined through a more comprehensive process. For example, a phrase query first checks whether a document contains all terms in the phrase. Next, it verifies that the terms are in order (which is a more expensive process). The match field is non-zero only for those queries that use the two-step verification process. |
score |
Contains the time taken for a Scorer to score a particular document. |
shallow_advance |
Contains the amount of time required to execute the advanceShallow Lucene method. |
compute_max_score |
Contains the amount of time required to execute the getMaxScore Lucene method. |
set_min_competitive_score |
Contains the amount of time required to execute the setMinCompetitiveScore Lucene method. |
<method>_count |
Contains the number of invocations of a <method>. For example, advance_count contains the number of invocations of the advance method. Different invocations of the same method occur because the method is called on different documents. You can determine the selectivity of a query by comparing counts in different query components. |
max_<method> |
The maximum amount of time taken by any slice to run a query method. Breakdown stats for the create_weight method do not include profiled max time because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
min_<method> |
The minimum amount of time taken by any slice to run a query method. Breakdown stats for the create_weight method do not include profiled min time because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
avg_<method> |
The average amount of time taken by any slice to run a query method. Breakdown stats for the create_weight method do not include profiled avg time because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
max_<method>_count |
The maximum number of invocations of a <method> on any slice. Breakdown stats for the create_weight method do not include profiled max count because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
min_<method>_count |
The minimum number of invocations of a <method> on any slice. Breakdown stats for the create_weight method do not include profiled min count because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
avg_<method>_count |
The average number of invocations of a <method> on any slice. Breakdown stats for the create_weight method do not include profiled avg count because the method runs at the query level rather than the slice level. This field is included only if you enable concurrent segment search. |
The collector array
collector 배열은 Lucene Collector에 대한 정보를 포함합니다. Collector는 문서 순회와 점수 계산을 조정하고 일치하는 문서를 수집하는 역할을 담당합니다. Collector를 사용하면 개별 쿼리가 애그리게이션 결과를 기록하고 전역 쿼리나 쿼리 후 필터를 실행할 수 있습니다.
| Field | Description |
|---|---|
name |
The collector name. In the example response, the collector is a single SimpleTopScoreDocCollector—the default scoring and sorting collector. |
reason |
Contains a description of the collector. For possible field values, see Collector reasons. |
time_in_nanos |
The total elapsed time for this collector, in nanoseconds. For concurrent segment search, time_in_nanos is the total amount of time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
children |
If a collector has subcollectors (children), this field contains information about the subcollectors. |
max_slice_time_in_nanos |
The maximum amount of time taken by any slice, in nanoseconds. This field is included only if you enable concurrent segment search. |
min_slice_time_in_nanos |
The minimum amount of time taken by any slice, in nanoseconds. This field is included only if you enable concurrent segment search. |
avg_slice_time_in_nanos |
The average amount of time taken by any slice, in nanoseconds. This field is included only if you enable concurrent segment search. |
slice_count |
The total slice count for this query. This field is included only if you enable concurrent segment search. |
reduce_time_in_nanos |
The amount of time taken to reduce results for all slice collectors, in nanoseconds. This field is included only if you enable concurrent segment search. |
Collector 시간은 독립적으로 계산·결합·정규화되므로 쿼리 시간과 무관합니다.
Collector reasons
다음 표는 사용할 수 있는 모든 collector reason을 설명합니다.
| Reason | Description |
|---|---|
search_sorted |
A collector that scores and sorts documents. Present in most simple searches. |
search_count |
A collector that counts the number of matching documents but does not fetch the source. Present when size: 0 is specified. |
search_terminate_after_count |
A collector that searches for matching documents and terminates the search when it finds a specified number of documents. Present when the terminate_after_count query parameter is specified. |
search_min_score |
A collector that returns matching documents that have a score greater than a minimum score. Present when the min_score parameter is specified. |
search_multi |
A wrapper collector for other collectors. Present when search, aggregations, global aggregations, and post filters are combined in a single search. |
search_timeout |
A collector that stops running after a specified period of time. Present when a timeout parameter is specified. |
aggregation |
A collector for aggregations that is run against the specified query scope. OpenSearch uses a single aggregation collector to collect documents for all aggregations. |
global_aggregation |
A collector that is run against the global query scope. Global scope is different from a specified query scope, so in order to collect the entire dataset, a match_all query must be run. |
Aggregation responses
Response: Global aggregation
응답에는 프로파일링 정보가 포함됩니다.
Response
{ "took" : 10 , "timed_out" : false , "_shards" : { "total" : 1 , "successful" : 1 , "skipped" : 0 , "failed" : 0 }, "hits" : { "total" : { "value" : 1370 , "relation" : "eq" }, "max_score" : null , "hits" : [] }, "aggregations" : { "all_products" : { "doc_count" : 4675 , "avg_price" : { "value" : 75.05542864304813 } }, "elitelligence_products" : { "value" : 68.4430200729927 } }, "profile" : { "shards" : [ { "id" : "[LidyZ1HVS-u93-73Z49dQg][opensearch_dashboards_sample_data_ecommerce][0]" , "inbound_network_time_in_millis" : 0 , "outbound_network_time_in_millis" : 0 , "searches" : [ { "query" : [ { "type" : "ConstantScoreQuery" , "description" : "ConstantScore(manufacturer:elitelligence)" , "time_in_nanos" : 1367487 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 634321 , "match" : 0 , "next_doc_count" : 1370 , "score_count" : 0 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 173250 , "advance_count" : 2 , "score" : 0 , "build_scorer_count" : 4 , "create_weight" : 132458 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 427458 }, "children" : [ { "type" : "TermQuery" , "description" : "manufacturer:elitelligence" , "time_in_nanos" : 1174794 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 470918 , "match" : 0 , "next_doc_count" : 1370 , "score_count" : 0 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 172084 , "advance_count" : 2 , "score" : 0 , "build_scorer_count" : 4 , "create_weight" : 114041 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 417751 } } ] } ], "rewrite_time" : 42542 , "collector" : [ { "name" : "MultiCollector" , "reason" : "search_multi" , "time_in_nanos" : 778406 , "children" : [ { "name" : "EarlyTerminatingCollector" , "reason" : "search_count" ... [truncated]
Response: Non-global aggregation
응답에는 프로파일링 정보가 포함됩니다.
Response
{ "took" : 13 , "timed_out" : false , "_shards" : { "total" : 1 , "successful" : 1 , "skipped" : 0 , "failed" : 0 }, "hits" : { "total" : { "value" : 4675 , "relation" : "eq" }, "max_score" : null , "hits" : [] }, "aggregations" : { "avg_taxful_total_price" : { "value" : 75.05542864304813 } }, "profile" : { "shards" : [ { "id" : "[LidyZ1HVS-u93-73Z49dQg][opensearch_dashboards_sample_data_ecommerce][0]" , "inbound_network_time_in_millis" : 0 , "outbound_network_time_in_millis" : 0 , "searches" : [ { "query" : [ { "type" : "ConstantScoreQuery" , "description" : "ConstantScore(*:*)" , "time_in_nanos" : 1690820 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 1614112 , "match" : 0 , "next_doc_count" : 4675 , "score_count" : 0 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 2708 , "advance_count" : 2 , "score" : 0 , "build_scorer_count" : 4 , "create_weight" : 20250 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 53750 }, "children" : [ { "type" : "MatchAllDocsQuery" , "description" : "*:*" , "time_in_nanos" : 770902 , "breakdown" : { "set_min_competitive_score_count" : 0 , "match_count" : 0 , "shallow_advance_count" : 0 , "set_min_competitive_score" : 0 , "next_doc" : 721943 , "match" : 0 , "next_doc_count" : 4675 , "score_count" : 0 , "compute_max_score_count" : 0 , "compute_max_score" : 0 , "advance" : 1042 , "advance_count" : 2 , "score" : 0 , "build_scorer_count" : 4 , "create_weight" : 5041 , "shallow_advance" : 0 , "create_weight_count" : 1 , "build_scorer" : 42876 } } ] } ], "rewrite_time" : 22000 , "collector" : [ { "name" : "MultiCollector" , "reason" : "search_multi" , "time_in_nanos" : 3672676 , "children" : [ { "name" : "EarlyTerminatingCollector" , "reason" : "search_count" , "time_in_nanos" : 78626 }, { "name" : "ProfilingAggregator: [avg_taxful_total_price]" , "reason" : "aggregation" , "time_in_nanos" :... [truncated]
Response body fields
aggregations 배열에는 다음 필드들이 있는 애그리게이션 객체가 포함됩니다.
| Field | Data type | Description |
|---|---|---|
type |
String | The aggregator type. In the non-global aggregation example response, the aggregator type is AvgAggregator. Global aggregation example response contains a GlobalAggregator with an AvgAggregator child. |
description |
String | Contains a Lucene explanation of the aggregation. Helps differentiate aggregations with the same type. |
time_in_nanos |
Long | The total elapsed time for this aggregation, in nanoseconds. For concurrent segment search, time_in_nanos is the total amount of time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
breakdown |
Object | Contains timing statistics about low-level Lucene execution. |
children |
Array of objects | If an aggregation has subaggregations (children), this field contains information about the subaggregations. |
debug |
Object | Some aggregations return a debug object that describes the details of the underlying execution. |
max_slice_time_in_nanos |
Long | The maximum amount of time taken by any slice to run an aggregation, in nanoseconds. This field is included only if you enable concurrent segment search. |
min_slice_time_in_nanos |
Long | The minimum amount of time taken by any slice to run an aggregation, in nanoseconds. This field is included only if you enable concurrent segment search. |
avg_slice_time_in_nanos |
Long | The average amount of time taken by any slice to run an aggregation, in nanoseconds. This field is included only if you enable concurrent segment search. |
The breakdown object
breakdown 객체는 저수준 Lucene 실행에 대한 타이밍 통계를 메서드별로 나타냅니다. breakdown 객체의 각 필드는 애그리게이션 내부에서 실행된 내부 Lucene 메서드를 나타냅니다. 타이밍은 벽시계 나노초로 표시되며 정규화되지 않습니다. breakdown 타이밍은 모든 하위 시간을 포함합니다. breakdown 객체는 다음 필드들로 구성됩니다. 모든 필드는 정수 값을 포함합니다.
| Field | Description |
|---|---|
initialize |
Contains the amount of time taken to execute the preCollection() callback method during AggregationCollectorManager creation. For concurrent segment search, the initialize method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
build_leaf_collector |
Contains the time spent running the aggregation’s getLeafCollector() method, which creates a new collector to collect the given context. For concurrent segment search, the build_leaf_collector method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
collect |
Contains the time spent collecting the documents into buckets. For concurrent segment search, the collect method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
post_collection |
Contains the time spent running the aggregation’s postCollection() callback method. For concurrent segment search, the post_collection method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
build_aggregation |
Contains the time spent running the aggregation’s buildAggregations() method, which builds the results of this aggregation. For concurrent segment search, the build_aggregation method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
reduce |
Contains the time spent in the reduce phase. For concurrent segment search, the reduce method contains the total elapsed time across all slices (the difference between the last completed slice execution end time and the first slice execution start time). |
<method>_count |
Contains the number of invocations of a <method>. For example, build_leaf_collector_count contains the number of invocations of the build_leaf_collector method. |
max_<method> |
The maximum amount of time taken by any slice to run an aggregation method. This field is included only if you enable concurrent segment search. |
min_<method> |
The minimum amount of time taken by any slice to run an aggregation method. This field is included only if you enable concurrent segment search. |
avg_<method> |
The average amount of time taken by any slice to run an aggregation method. This field is included only if you enable concurrent segment search. |
<method>_count |
The total method count across all slices. For example, for the collect method, it is the total number of invocations of this method needed to collect documents into buckets across all slices. |
max_<method>_count |
The maximum number of invocations of a <method> on any slice. This field is included only if you enable concurrent segment search. |
min_<method>_count |
The minimum number of invocations of a <method> on any slice. This field is included only if you enable concurrent segment search. |
avg_<method>_count |
The average number of invocations of a <method> on any slice. This field is included only if you enable concurrent segment search. |
더 알아보기 (Learn more)
Profile API는 성능 문제를 진단할 때 가장 유용한 도구 중 하나예요. 쿼리, 컬렉터, 애그리게이션의 breakdown 타이밍을 보면 어떤 부분이 느린지 정확히 짚어낼 수 있습니다. 특히 동시 세그먼트 검색을 켰다면 슬라이스 관련 필드(max/min/avg_slice_time_in_nanos)도 함께 확인해 병렬화 효과를 평가해 보세요. 검색 성능 최적화에 대한 더 깊은 내용은 OpenSearch docs의 concurrent segment search 문서를 참고해 주세요.