分析
1.0 版引入
Profile API 提供有关搜索请求中各个组件执行的计时信息。使用 Profile API,您可以调试慢速请求并了解如何提高其性能。Profile API 不测量以下内容:
- 网络延迟
- 搜索获取阶段花费的时间
- 请求在队列中花费的时间量
- 在协调节点上合并分片响应时的空闲时间
Profile API 是一种资源消耗型操作,会增加搜索操作的开销。
端点
GET /testindex/_search
{
"profile": true,
"query" : {
"match" : { "title" : "wind" }
}
}
并发分段搜索
从 OpenSearch 2.12 开始,并发分段搜索允许每个分片级别的请求在查询阶段并行搜索分段。Profile API 响应包含几个附加字段,其中包含有关切片的统计信息。
切片是可由线程执行的工作单元。每个查询可以被划分为多个切片,每个切片包含一个或多个分段。所有切片可以并行执行,也可以根据池中可用线程的顺序执行。
通常,最大/最小/平均切片时间会捕获所有切片在特定计时类型上的统计信息。例如,在分析聚合时,aggregations
部分中的 max_slice_time_in_nanos
字段显示聚合操作及其子项在所有切片中消耗的最大时间。
示例请求
非并发搜索
要使用 Profile API,请在发送到 _search
端点的搜索请求中包含并将 profile
参数设置为 true
。
GET /testindex/_search
{
"profile": true,
"query" : {
"match" : { "title" : "wind" }
}
}
要开启人类可读格式,请在请求中包含查询参数 ?human=true
。
GET /testindex/_search?human=true
{
"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
以使响应更易于理解。
聚合
要对聚合进行性能分析,请发送聚合请求并将 profile
参数设置为 true
。
全局聚合
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" } }
}
}
非全局聚合
GET /opensearch_dashboards_sample_data_ecommerce/_search
{
"size": 0,
"aggs": {
"avg_taxful_total_price": {
"avg": {
"field": "taxful_total_price"
}
}
}
}
示例响应
非并发搜索
响应包含性能分析信息。
响应
{
"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": []
}
]
}
}
并发分段搜索
以下是包含三个分段切片的并发分段搜索的响应示例:
响应
{
"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_scorer": 32459,
"max_set_min_competitive_score": 0,
"max_compute_max_score": 0,
"min_shallow_advance": 0,
"match": 0,
"max_shallow_advance": 0,
"avg_advance_count": 0,
"min_next_doc": 708,
"max_advance_count": 0,
"min_score": 291,
"max_next_doc": 999,
"create_weight": 1834,
"avg_next_doc_count": 2,
"max_score": 376,
"min_compute_max_score_count": 0,
"min_score_count": 1,
"min_advance_count": 0
}
}
],
"rewrite_time": 8126,
"collector": [
{
"name": "QueryCollectorManager",
"reason": "search_multi",
"time_in_nanos": 564708,
"reduce_time_in_nanos": 1251042,
"max_slice_time_in_nanos": 121959,
"min_slice_time_in_nanos": 28958,
"avg_slice_time_in_nanos": 83208,
"slice_count": 3,
"children": [
{
"name": "SimpleTopDocsCollectorManager",
"reason": "search_top_hits",
"time_in_nanos": 500459,
"reduce_time_in_nanos": 840125,
"max_slice_time_in_nanos": 22168,
"min_slice_time_in_nanos": 5792,
"avg_slice_time_in_nanos": 12084,
"slice_count": 3
},
{
"name": "NonGlobalAggCollectorManager: [histo]",
"reason": "aggregation",
"time_in_nanos": 552167,
"reduce_time_in_nanos": 311292,
"max_slice_time_in_nanos": 95333,
"min_slice_time_in_nanos": 18416,
"avg_slice_time_in_nanos": 66249,
"slice_count": 3
}
]
}
]
}
],
"aggregations": [
{
"type": "NumericHistogramAggregator",
"description": "histo",
"time_in_nanos": 2847834,
"max_slice_time_in_nanos": 117374,
"min_slice_time_in_nanos": 20624,
"avg_slice_time_in_nanos": 75597,
"breakdown": {
"min_build_leaf_collector": 9500,
"build_aggregation_count": 3,
"post_collection": 3209,
"max_collect_count": 2,
"initialize_count": 3,
"reduce_count": 0,
"avg_collect": 17055,
"max_build_aggregation": 26000,
"avg_collect_count": 1,
"max_build_leaf_collector": 64833,
"min_build_leaf_collector_count": 1,
"build_aggregation": 41125,
"min_initialize": 583,
"max_reduce": 0,
"build_leaf_collector_count": 3,
"avg_reduce": 0,
"min_collect_count": 1,
"avg_build_leaf_collector_count": 1,
"avg_build_leaf_collector": 45000,
"max_collect": 24625,
"reduce": 0,
"avg_build_aggregation": 12013,
"min_post_collection": 292,
"max_initialize": 1333,
"max_post_collection": 750,
"collect_count": 5,
"avg_post_collection": 541,
"avg_initialize": 986,
"post_collection_count": 3,
"build_leaf_collector": 86833,
"min_collect": 6250,
"min_build_aggregation": 3541,
"initialize": 2786791,
"max_build_leaf_collector_count": 1,
"min_reduce": 0,
"collect": 29834
},
"debug": {
"total_buckets": 1
}
}
]
}
]
}
}
响应正文字段
响应包括以下字段。
字段 | 数据类型 | 描述 |
---|---|---|
profile | 对象 | 包含性能分析信息。 |
profile.shards | 对象数组 | 搜索请求可以针对索引中的一个或多个分片执行,并且搜索可能涉及一个或多个索引。因此,profile.shards 数组包含参与搜索的每个分片的性能分析信息。 |
profile.shards.id | 字符串 | 分片 ID,格式为 [node-ID][index-name][shard-ID] 。 |
profile.shards.searches | 对象数组 | 搜索表示针对底层 Lucene 索引执行的查询。大多数搜索请求对 Lucene 索引执行一次搜索,但有些搜索请求可以执行多次搜索。例如,包含全局聚合会导致全局上下文的辅助 match_all 查询。profile.shards 数组包含每个搜索执行的性能分析信息。 |
profile.shards.searches.query | 对象数组 | 有关查询执行的性能分析信息。 |
profile.shards.searches.rewrite_time | 整数 | 所有 Lucene 查询都会被重写。查询及其子查询可能会被重写多次,直到查询不再变化。重写过程包括执行优化,例如删除冗余子句或用更高效的查询路径替换。重写过程后,原始查询可能会发生显著变化。rewrite_time 字段包含查询及其所有子查询的累计总重写时间,以纳秒为单位。 |
profile.shards.searches.collector | 对象数组 | 有关运行搜索的 Lucene 收集器的性能分析信息。 |
profile.shards.aggregations | 对象数组 | 有关聚合执行的性能分析信息。 |
查询 query
数组
查询 query
数组包含具有以下字段的对象。
字段 | 数据类型 | 描述 |
---|---|---|
type | 字符串 | 搜索查询被重写成的 Lucene 查询类型。对应于 Lucene 类名(在 OpenSearch 中通常具有相同的名称)。 |
description | 字符串 | 包含 Lucene 对查询的解释。有助于区分相同类型的查询。 |
time_in_nanos | 长整型 | 此查询的总耗时,以纳秒为单位。对于并发分段搜索,time_in_nanos 是所有切片上花费的总时间(最后完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
max_slice_time_in_nanos | 长整型 | 任意切片运行查询所花费的最大时间量,以纳秒为单位。此字段仅在您启用并发分段搜索时包含。 |
min_slice_time_in_nanos | 长整型 | 任意切片运行查询所花费的最小时间量,以纳秒为单位。此字段仅在您启用并发分段搜索时包含。 |
avg_slice_time_in_nanos | 长整型 | 任意切片运行查询所花费的平均时间量,以纳秒为单位。此字段仅在您启用并发分段搜索时包含。 |
breakdown | 对象 | 包含有关底层 Lucene 执行的计时统计信息。 |
children | 对象数组 | 如果查询具有子查询,此字段包含有关子查询的信息。 |
breakdown
对象
breakdown
对象表示按方法划分的底层 Lucene 执行的计时统计信息。计时以实时纳秒列出,且未标准化。breakdown
计时包括所有子项的时间。breakdown
对象包含以下字段。所有字段都包含整数值。
字段 | 描述 |
---|---|
create_weight | Lucene 中的 Query 对象是不可变的。然而,Lucene 应该能够在多个 IndexSearcher 对象中重用 Query 对象。因此,Query 对象需要保留与执行查询的索引相关的临时状态和统计信息。为了实现重用,每个 Query 对象都会生成一个 Weight 对象,该对象保留与 <IndexSearcher, Query> 元组相关的临时上下文(状态)。create_weight 字段包含创建 Weight 对象所花费的时间量。 |
build_scorer | 一个 Scorer 迭代匹配的文档并为每个文档生成一个分数。build_scorer 字段包含生成 Scorer 对象所花费的时间。这不包括对文档进行评分所花费的时间。Scorer 的初始化时间取决于特定查询的优化和复杂性。build_scorer 参数还包括与缓存相关的时间量,如果缓存适用于查询并已启用。 |
next_doc | next_doc Lucene 方法返回与查询匹配的下一个文档的 ID。此方法是 advance 方法的一种特殊类型,等同于 advance(docId() + 1) 。next_doc 方法对许多 Lucene 查询来说更为方便。next_doc 字段包含确定下一个匹配文档所需的时间量,这取决于查询类型而异。 |
advance | advance 方法是 Lucene 中 next_doc 方法的较低级别版本。它也查找下一个匹配文档,但要求调用查询执行额外的任务,例如识别跳过。某些查询,例如连词(布尔查询中的 must 子句),不能使用 next_doc 。对于这些查询,advance 会被计时。 |
match | 对于某些查询,文档匹配分两步执行。首先,文档进行近似匹配。其次,通过更全面的过程检查那些近似匹配的文档。例如,短语查询首先检查文档是否包含短语中的所有术语。接下来,它验证术语是否按顺序排列(这是一个更耗费资源的过程)。match 字段仅在使用两步验证过程的查询中为非零。 |
score | 包含 Scorer 为特定文档评分所花费的时间。 |
shallow_advance | 包含执行 advanceShallow Lucene 方法所需的时间量。 |
compute_max_score | 包含执行 getMaxScore Lucene 方法所需的时间量。 |
set_min_competitive_score | 包含执行 setMinCompetitiveScore Lucene 方法所需的时间量。 |
<method>_count | 包含 <method> 的调用次数。例如,advance_count 包含 advance 方法的调用次数。同一方法的不同调用发生是因为该方法在不同文档上被调用。您可以通过比较不同查询组件中的计数来确定查询的选择性。 |
max_<method> | 任何切片运行查询方法所花费的最大时间量。create_weight 方法的细分统计信息不包括配置文件中的 max 时间,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
min_<method> | 任何切片运行查询方法所花费的最小时间量。create_weight 方法的细分统计信息不包括配置文件中的 min 时间,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
avg_<method> | 任何切片运行查询方法所花费的平均时间量。create_weight 方法的细分统计信息不包括配置文件中的 avg 时间,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
max_<method>_count | 任何切片上 <method> 的最大调用次数。create_weight 方法的细分统计信息不包括配置文件中的 max 计数,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
min_<method>_count | 任何切片上 <method> 的最小调用次数。create_weight 方法的细分统计信息不包括配置文件中的 min 计数,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
avg_<method>_count | 任何切片上 <method> 的平均调用次数。create_weight 方法的细分统计信息不包括配置文件中的 avg 计数,因为该方法在查询级别而不是切片级别运行。仅当您启用并发段搜索时才包含此字段。 |
The collector
array
collector
数组包含有关 Lucene Collectors 的信息。Collector 负责协调文档遍历、评分和收集匹配文档。使用 Collectors,单个查询可以记录聚合结果并执行全局查询或查询后过滤器。
字段 | 描述 |
---|---|
名称 | 收集器名称。在示例响应中,collector 是一个单独的 SimpleTopScoreDocCollector ——默认的评分和排序收集器。 |
reason | 包含收集器的描述。有关可能的字段值,请参阅收集器原因。 |
time_in_nanos | 此收集器的总耗时,以纳秒为单位。对于并发段搜索,time_in_nanos 是所有切片上的总时间量(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
children | 如果收集器有子收集器(children),此字段包含有关子收集器的信息。 |
max_slice_time_in_nanos | 任何切片所花费的最大时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
min_slice_time_in_nanos | 任何切片所花费的最小时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
avg_slice_time_in_nanos | 任何切片所花费的平均时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
slice_count | 此查询的总切片计数。仅当您启用并发段搜索时才包含此字段。 |
reduce_time_in_nanos | 减少所有切片收集器结果所花费的时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
收集器时间是独立计算、组合和标准化的,因此它们与查询时间无关。
收集器原因
下表描述了所有可用的收集器原因。
原因 | 描述 |
---|---|
search_sorted | 一个对文档进行评分和排序的收集器。存在于大多数简单搜索中。 |
search_count | 一个计算匹配文档数量但不获取源的收集器。当指定 size: 0 时出现。 |
search_terminate_after_count | 一个搜索匹配文档并在找到指定数量的文档时终止搜索的收集器。当指定 terminate_after_count 查询参数时出现。 |
search_min_score | 一个返回得分高于最小得分的匹配文档的收集器。当指定 min_score 参数时出现。 |
search_multi | 其他收集器的包装收集器。当搜索、聚合、全局聚合和后过滤器组合在单个搜索中时出现。 |
search_timeout | 一个在指定时间段后停止运行的收集器。当指定 timeout 参数时出现。 |
aggregation | 针对指定查询范围运行的聚合收集器。OpenSearch 使用单个 aggregation 收集器来收集所有聚合的文档。 |
global_aggregation | 一个针对全局查询范围运行的收集器。全局范围与指定的查询范围不同,因此为了收集整个数据集,必须运行 match_all 查询。 |
聚合响应
响应:全局聚合
响应包含性能分析信息。
响应
{
"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",
"time_in_nanos": 70290
},
{
"name": "ProfilingAggregator: [elitelligence_products]",
"reason": "aggregation",
"time_in_nanos": 502780
}
]
}
]
},
{
"query": [
{
"type": "ConstantScoreQuery",
"description": "ConstantScore(*:*)",
"time_in_nanos": 995345,
"breakdown": {
"set_min_competitive_score_count": 0,
"match_count": 0,
"shallow_advance_count": 0,
"set_min_competitive_score": 0,
"next_doc": 930803,
"match": 0,
"next_doc_count": 4675,
"score_count": 0,
"compute_max_score_count": 0,
"compute_max_score": 0,
"advance": 2209,
"advance_count": 2,
"score": 0,
"build_scorer_count": 4,
"create_weight": 23875,
"shallow_advance": 0,
"create_weight_count": 1,
"build_scorer": 38458
},
"children": [
{
"type": "MatchAllDocsQuery",
"description": "*:*",
"time_in_nanos": 431375,
"breakdown": {
"set_min_competitive_score_count": 0,
"match_count": 0,
"shallow_advance_count": 0,
"set_min_competitive_score": 0,
"next_doc": 389875,
"match": 0,
"next_doc_count": 4675,
"score_count": 0,
"compute_max_score_count": 0,
"compute_max_score": 0,
"advance": 1167,
"advance_count": 2,
"score": 0,
"build_scorer_count": 4,
"create_weight": 9458,
"shallow_advance": 0,
"create_weight_count": 1,
"build_scorer": 30875
}
}
]
}
],
"rewrite_time": 8792,
"collector": [
{
"name": "ProfilingAggregator: [all_products]",
"reason": "aggregation_global",
"time_in_nanos": 1310536
}
]
}
],
"aggregations": [
{
"type": "AvgAggregator",
"description": "elitelligence_products",
"time_in_nanos": 319918,
"breakdown": {
"reduce": 0,
"post_collection_count": 1,
"build_leaf_collector": 130709,
"build_aggregation": 2709,
"build_aggregation_count": 1,
"build_leaf_collector_count": 2,
"post_collection": 584,
"initialize": 4750,
"initialize_count": 1,
"reduce_count": 0,
"collect": 181166,
"collect_count": 1370
}
},
{
"type": "GlobalAggregator",
"description": "all_products",
"time_in_nanos": 1519340,
"breakdown": {
"reduce": 0,
"post_collection_count": 1,
"build_leaf_collector": 134625,
"build_aggregation": 59291,
"build_aggregation_count": 1,
"build_leaf_collector_count": 2,
"post_collection": 5041,
"initialize": 24500,
"initialize_count": 1,
"reduce_count": 0,
"collect": 1295883,
"collect_count": 4675
},
"children": [
{
"type": "AvgAggregator",
"description": "avg_price",
"time_in_nanos": 775967,
"breakdown": {
"reduce": 0,
"post_collection_count": 1,
"build_leaf_collector": 98999,
"build_aggregation": 33083,
"build_aggregation_count": 1,
"build_leaf_collector_count": 2,
"post_collection": 2209,
"initialize": 1708,
"initialize_count": 1,
"reduce_count": 0,
"collect": 639968,
"collect_count": 4675
}
}
]
}
]
}
]
}
}
响应:非全局聚合
响应包含性能分析信息。
响应
{
"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": 2834566
}
]
}
]
}
],
"aggregations": [
{
"type": "AvgAggregator",
"description": "avg_taxful_total_price",
"time_in_nanos": 1973702,
"breakdown": {
"reduce": 0,
"post_collection_count": 1,
"build_leaf_collector": 199292,
"build_aggregation": 13584,
"build_aggregation_count": 1,
"build_leaf_collector_count": 2,
"post_collection": 6125,
"initialize": 6916,
"initialize_count": 1,
"reduce_count": 0,
"collect": 1747785,
"collect_count": 4675
}
}
]
}
]
}
}
响应正文字段
aggregations
数组包含具有以下字段的聚合对象。
字段 | 数据类型 | 描述 |
---|---|---|
type | 字符串 | 聚合器类型。在非全局聚合示例响应中,聚合器类型是 AvgAggregator 。全局聚合示例响应包含一个带有 AvgAggregator 子项的 GlobalAggregator 。 |
description | 字符串 | 包含聚合的 Lucene 解释。有助于区分相同类型的聚合。 |
time_in_nanos | 长整型 | 此聚合的总耗时,以纳秒为单位。对于并发段搜索,time_in_nanos 是所有切片上的总时间量(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
breakdown | 对象 | 包含有关底层 Lucene 执行的计时统计信息。 |
children | 对象数组 | 如果聚合有子聚合(children),此字段包含有关子聚合的信息。 |
debug | 对象 | 某些聚合返回一个 debug 对象,该对象描述了底层执行的详细信息。 |
max_slice_time_in_nanos | 长整型 | 任何切片运行聚合所花费的最大时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
min_slice_time_in_nanos | 长整型 | 任何切片运行聚合所花费的最小时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
avg_slice_time_in_nanos | 长整型 | 任何切片运行聚合所花费的平均时间量,以纳秒为单位。仅当您启用并发段搜索时才包含此字段。 |
breakdown
对象
breakdown
对象表示低级别 Lucene 执行的计时统计信息,按方法细分。breakdown
对象中的每个字段都表示在聚合中执行的内部 Lucene 方法。计时以挂钟纳秒列出,未标准化。breakdown
计时包括所有子时间。breakdown
对象由以下字段组成。所有字段都包含整数值。
字段 | 描述 |
---|---|
initialize | 包含在创建 AggregationCollectorManager 期间执行 preCollection() 回调方法所花费的时间量。对于并发段搜索,initialize 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
build_leaf_collector | 包含运行聚合的 getLeafCollector() 方法所花费的时间,该方法创建一个新的收集器来收集给定的上下文。对于并发段搜索,build_leaf_collector 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
collect | 包含将文档收集到桶中所需的时间。对于并发段搜索,collect 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
post_collection | 包含运行聚合的 postCollection() 回调方法所花费的时间。对于并发段搜索,post_collection 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
build_aggregation | 包含运行聚合的 buildAggregations() 方法所花费的时间,该方法构建此聚合的结果。对于并发段搜索,build_aggregation 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
reduce | 包含在 reduce 阶段所花费的时间。对于并发段搜索,reduce 方法包含所有切片上的总耗时(最后一个完成的切片执行结束时间与第一个切片执行开始时间之间的差值)。 |
<method>_count | 包含 <method> 的调用次数。例如,build_leaf_collector_count 包含 build_leaf_collector 方法的调用次数。 |
max_<method> | 任何切片运行聚合方法所花费的最大时间量。仅当您启用并发段搜索时才包含此字段。 |
min_<method> | 任何切片运行聚合方法所花费的最小时间量。仅当您启用并发段搜索时才包含此字段。 |
avg_<method> | 任何切片运行聚合方法所花费的平均时间量。仅当您启用并发段搜索时才包含此字段。 |
<method>_count | 所有切片上的总方法计数。例如,对于 collect 方法,它是将文档收集到所有切片中的桶所需的方法调用总数。 |
max_<method>_count | 任何切片上 <method> 的最大调用次数。仅当您启用并发段搜索时才包含此字段。 |
min_<method>_count | 任何切片上 <method> 的最小调用次数。仅当您启用并发段搜索时才包含此字段。 |
avg_<method>_count | 任何切片上 <method> 的平均调用次数。仅当您启用并发段搜索时才包含此字段。 |