MongoDB Search クエリは、explain メソッドを有効にしてクエリを実行すると、$search クエリプランと実行統計に関する情報を返します。explain でクエリを実行すると、MongoDB Search は統計情報と、クエリが Lucene 内部でどのように実行されたかを示すメタデータを含む BSON ドキュメントを返します。
Tip
構文
db.<myCollection>.explain("<verbosity>").aggregate([ { $search: { "<operator>": { "<operator-options>" } } } ])
冗長
冗長モードは、explain の動作と返される情報の量を制御します。値は、冗長を減らすために、次のいずれかになります。
クエリの実行統計を含む | |
クエリの実行統計情報をもつ | |
queryPlanner (デフォルト) | クエリプランに関する情報。 |
Tip
出力
explain メソッドによるクエリは、stages.$_internalSearchMongotRemote オブジェクトの以下のフィールドを返します。
オプション | タイプ | 目的 |
|---|---|---|
| ドキュメント | 実行したクエリが含まれます。 |
| ドキュメント | Contains the |
| 整数の配列 |
|
explain の結果
explainメソッドは、explain ドキュメント内の次のフィールドを含む BSON ドキュメントを返します。
オプション | タイプ | 必要性 | 目的 |
|---|---|---|---|
| ドキュメント | 任意 | コレクターの実行統計を説明します。 |
| ドキュメント | 任意 | |
| ドキュメントの配列 | 任意 | インデックスごとのパーティションの詳細が含まれています。これは2つ以上のインデックス パーティションを設定した場合にのみ返されます。 |
| ドキュメント | 任意 | 有用なメタデータを含んでいます。 |
| ドキュメント | 任意 | クエリの実行統計を説明します。これは返されません。 |
| ドキュメント | 任意 | クエリ実行後に Lucene からドキュメントごとのデータを取得するための詳細。 |
| ドキュメント | 任意 | クエリが実行されたときのリソース使用状況を詳述します。 |
collectors
collectors BSON ドキュメントには、次のフィールドが含まれています。
フィールド | タイプ | 必要性 | 目的 |
|---|---|---|---|
| ドキュメント | 必須 | Statistics of all collectors of the query. Statistics reported represent either the maximum value across all collectors used in the query or a sum of the statistic across all the sub-collectors. The timing statistics are summed to reflect the total time spent across all collectors for the entire query. To learn more, see allCollectorStats. |
| ドキュメント | 任意 | |
| ドキュメント | 任意 |
allCollectorStats
allCollectorStatsBSON ドキュメントには、クエリで指定されたすべてのコレクターの統計が記載されており、facetやsortが含まれます。これには、次のキーが含まれています。
フィールド | 説明 |
|---|---|
| コレクターが収集した期間と結果の数を追跡します。 |
| コレクターから |
| スコアラーがコレクターに設定された合計時間と回数を追跡する統計。 |
facet
facet は、BSON ドキュメントであり、クエリにファセットを指定した場合のクエリおよび実行統計を詳細に示します。次のフィールドが含まれています。
オプション | タイプ | 必要性 | 目的 |
|---|---|---|---|
| ドキュメント | 任意 |
|
| ドキュメント | 任意 | すべてのファセット グループを保持する内部の Lucene オブジェクトの作成に関連する統計を表示します。 |
| ドキュメント | 必須 | クエリに一致したドキュメントと Lucene インデックス全体の両方に対して、ファセット対象のフィールドをその濃度にマッピングします。これにより、各フィールドについて次の濃度情報が提供されます。
|
sort
sort は、クエリでソートを指定したときに、クエリと実行統計を詳細に示す BSON ドキュメントです。次のフィールドが含まれています。
オプション | タイプ | 必要性 | 目的 |
|---|---|---|---|
| ドキュメント | 任意 | すべてのソート フィールドにわたる
|
| ドキュメント | 必須 | ソート対象のフィールドを、そのフィールドのインデックスに存在するデータ型のリストにマッピングします。 |
| ブール値 | 任意 | クエリがインデックスのソートの利点を受けられるかどうかを示します。クエリのソートフィールドがインデックスのソートと一致するか、またはその接頭を構成する場合、クエリは利点を受けられます。値が次の場合:
クエリでソートが指定されていない場合、またはインデックスにソート仕様がない場合、これは出力には表示されません。 |
highlight
highlight は、クエリでハイライトを指定した場合に、クエリと実行の統計を詳細に示す BSON ドキュメントです。次のフィールドが含まれています。
オプション | タイプ | 必要性 | 目的 |
|---|---|---|---|
| List<String> | 必須 | ハイライトされたすべてのフィールドの一覧。クエリの |
| QueryExecutionArea | 任意 | ハイライトの設定および実行に関連する呼び出しとタイミングの統計。次のフィールドが含まれています。
|
indexPartitionExplain
the indexPartitionExplain contains Explain Results for each index partition. The top-level collectors and query are inside the explain information of each index partition and absent at the top-level.
metadata
metadata には、次のような有用なメタデータが含まれています。
フィールド | タイプ | 必要性 | 目的 |
|---|---|---|---|
| 文字列 | 任意 |
|
| 文字列 | 任意 |
|
| 文字列 | 任意 | クエリで使用されるMongoDB Searchインデックス。 |
| ドキュメント | 任意 |
|
| 整数 | 任意 | 削除されたドキュメントを含むインデックス内のインデックス オブジェクトの総数。 |
query
query BSON ドキュメントには、クエリの実行統計が記述されています。次のフィールドが含まれています。
フィールド | タイプ | 必要性 | 目的 |
|---|---|---|---|
| string | 任意 | 演算子へのパス(ルートでない場合のみ)。 |
| string | 必須 | MongoDB Search 演算子が作成した Lucene クエリの名前。詳しくは、 |
| string | 任意 | |
| ドキュメント | 必須 | Lucene クエリ情報。詳細については、 |
| ドキュメント | 任意 |
|
args
The explain response of a search command contains information about the query executed with that command. The response in the args field includes structured details of what Lucene queries MongoDB Search executed to satisfy a $search query.
このセクションには、次の内容が含まれています。
MongoDB Search 演算子が作成する Lucene クエリの一部
構造化サマリーに含まれる Lucene クエリ オプション
各 Lucene クエリ タイプの Lucene クエリ構造の概要の例
注意
例について
The examples in this section are based on queries run against the sample datasets with the queryPlanner verbosity mode. In the example response, the:
mongotQueryフィールドには、 MongoDB Search 演算子と実行されたクエリが表示されます。explain.typeフィールドには、演算子が作成した Lucene クエリが表示されます。
完全な例については、「例」を参照してください。
BooleanQueryLucene
BooleanQueryの場合、構造化されたサマリーには次のオプションに関する詳細が含まれます。フィールドタイプ必要性説明must任意
一致する必要がある句。
mustNot任意
一致してはならない句。
should任意
一致する必要がある句。
filter任意
すべて一致する必要がある句。
minimumShouldMatch整数
任意
一致する必要がある
should句の最小数。次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "compound" : { 7 "must" : [ { 8 "compound" : { 9 "should" : [ { 10 "text" : { 11 "query" : "historic", 12 "path" : "summary" 13 } 14 }, 15 { 16 "text" : { 17 "query" : "Portugal", 18 "path" : "address.country" 19 } 20 }, 21 { 22 "text" : { 23 "query" : "railway", 24 "path" : "transit" 25 } 26 } ] 27 } 28 } ], 29 "mustNot" : [ { 30 "text" : { 31 "query" : "Apartment", 32 "path" : "property_type" 33 } 34 } ] 35 } 36 }, 37 "explain" : { 38 "type" : "BooleanQuery", 39 "args" : { 40 "must" : [ { 41 "path" : "compound.must", 42 "type" : "BooleanQuery", 43 "args" : { 44 "must" : [ ], 45 "mustNot" : [ ], 46 "should" : [ 47 { 48 "path" : "compound.must.compound.should[0]", 49 "type" : "TermQuery", 50 "args" : { 51 "path" : "summary", 52 "value" : "historic" 53 } 54 }, 55 { 56 "path" : "compound.must.compound.should[1]", 57 "type" : "TermQuery", 58 "args" : { 59 "path" : "address.country", 60 "value" : "portugal" 61 } 62 }, 63 { 64 "path" : "compound.must.compound.should[2]", 65 "type" : "TermQuery", 66 "args" : { 67 "path" : "transit", 68 "value" : "railway" 69 } 70 } 71 ], 72 "filter" : [ ], 73 "minimumShouldMatch" : 0 74 } 75 } ], 76 "mustNot" : [ { 77 "path" : "compound.mustNot", 78 "type" : "TermQuery", 79 "args" : { 80 "path" : "property_type", 81 "value" : "apartment" 82 } 83 } ], 84 "should" : [ ], 85 "filter" : [ ], 86 "minimumShouldMatch" : 0 87 } 88 } 89 }, 90 ... 91 }, 92 ... 93 ], 94 ... 95 }
ConstantScoreQuery定数スコアクエリの場合、構造化されたサマリーには次のオプションの詳細が含まれます。
フィールドタイプ必要性説明query必須
ConstantScoreQueryの子。次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "equals" : { 7 "path" : "host.host_identity_verified", 8 "value" : true 9 } 10 }, 11 "explain" : { 12 "type" : "ConstantScoreQuery", 13 "args" : { 14 "query" : { 15 "type" : "TermQuery", 16 "args" : { 17 "path" : "host.host_identity_verified", 18 "value" : "T" 19 } 20 } 21 } 22 } 23 } 24 }, 25 { 26 "$_internalSearchIdLookup" : { } 27 } 28 ], 29 ... 30 }
FunctionScoreQueryLucene
FunctionScoreQueryクエリの場合、構造化されたサマリーには次のオプションに関する詳細が含まれます。フィールドタイプ必要性説明scoreFunctionstring
必須
クエリで使用される スコア式 。
query必須
クエリ。
次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "near" : { 7 "path" : "accomodates", 8 "origin" : 8, 9 "pivot" : 2 10 } 11 }, 12 "explain" : { 13 "type" : "BooleanQuery", 14 "args" : { 15 "must" : [ ], 16 "mustNot" : [ ], 17 "should" : [ 18 { 19 "type" : "BooleanQuery", 20 "args" : { 21 "must" : [ ], 22 "mustNot" : [ ], 23 "should" : [ 24 { 25 "type" : "FunctionScoreQuery", 26 "args" : { 27 "scoreFunction" : "expr(pivot / (pivot + abs(origin - value)))", 28 "query" : { 29 "type" : "LongDistanceFeatureQuery", 30 "args" : { }, 31 "stats" : { } 32 } 33 } 34 } 35 ], 36 "filter" : [ 37 { 38 "type" : "PointRangeQuery", 39 "args" : { 40 "path" : "accomodates", 41 "representation" : "double", 42 "gte" : 8.000000000000002, 43 "lte" : NaN 44 } 45 } 46 ], 47 "minimumShouldMatch" : 0 48 } 49 }, 50 { 51 "type" : "LongDistanceFeatureQuery", 52 "args" : { }, 53 "stats" : { } 54 } 55 ], 56 "filter" : [ ], 57 "minimumShouldMatch" : 0 58 } 59 } 60 }, 61 ... 62 }, 63 ... 64 ], 65 ... 66 }
LatLonPointDistanceQueryFor Lucene
LatLonPointDistanceQueryqueries, the response contains anstatsonly.次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "geoWithin" : { 7 "path" : "address.location", 8 "circle" : { 9 "radius" : 4800, 10 "center" : { 11 "type" : "Point", 12 "coordinates" : [ 13 -122.419472, 14 37.765302 15 ] 16 } 17 } 18 } 19 }, 20 "explain" : { 21 "type" : "LatLonPointDistanceQuery", 22 "args" : { } 23 } 24 } 25 }, 26 ... 27 ], 28 ... 29 }
LatLonShapeQueryFor Lucene
LatLonShapeQueryqueries, the response contains anstatsonly.次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "geoShape" : { 7 "path" : "address.location", 8 "relation" : "within", 9 "geometry" : { 10 "type" : "Polygon", 11 "coordinates" : [ 12 [ 13 [ -74.3994140625, 40.5305017757 ], 14 [ -74.7290039063, 40.5805846641 ], 15 [ -74.7729492188, 40.9467136651 ], 16 [ -74.0698242188, 41.1290213475 ], 17 [ -73.65234375, 40.9964840144 ], 18 [ -72.6416015625, 40.9467136651 ], 19 [ -72.3559570313, 40.7971774152 ], 20 [ -74.3994140625, 40.5305017757 ] 21 ] 22 ] 23 } 24 } 25 }, 26 "explain" : { 27 "type" : "LatLonShapeQuery", 28 "args" : { } 29 } 30 }, 31 ... 32 }, 33 ... 34 ], 35 ... 36 }
LongDistanceFeatureQueryFor Lucene
LongDistanceFeatureQuery, the response contains anstatsonly.次の例では、
sample_mflix.moviesコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "near" : { 7 "path" : "released", 8 "origin" : ISODate("1915-09-13T00:00:00Z"), 9 "pivot" : 7776000000 10 } 11 }, 12 "explain" : { 13 "type" : "LongDistanceFeatureQuery", 14 "args" : { } 15 } 16 }, 17 ... 18 }, 19 ... 20 ], 21 ... 22 }
MultiTermQueryConstantScoreWrapperLucene
MultiTermQueryConstantScoreWrapperクエリの場合、構造化されたサマリーには次の引数に関する詳細が含まれます。フィールドタイプ必要性説明queriesList<Explain Results>
必須
クエリのリスト。
次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "regex" : { 7 "path" : "access", 8 "query" : "full(.{0,5})", 9 "allowAnalyzedField" : true 10 } 11 }, 12 "explain" : { 13 "type" : "MultiTermQueryConstantScoreWrapper", 14 "args" : { 15 "queries" : [ 16 { 17 "type" : "DefaultQuery", 18 "args" : { 19 "queryType" : "RegexpQuery" 20 } 21 } 22 ] 23 } 24 } 25 }, 26 ... 27 }, 28 ... 29 ], 30 ... 31 }
PhraseQueryLucene
PhraseQueryクエリの場合、構造化されたサマリーには次の引数に関する詳細が含まれます。フィールドタイプ必要性説明path文字列
必須
検索するインデックス付きフィールド。
query文字列
必須
検索する文字列または複数の文字列。
slop番号
必須
queryフレーズ内の単語間の許容距離。次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "phrase" : { 7 "path" : "description", 8 "query" : "comfortable apartment", 9 "slop" : 2 10 } 11 }, 12 "explain" : { 13 "type" : "PhraseQuery", 14 "args" : { 15 "path" : "description", 16 "query" : "[comfortable, apartment]", 17 "slop" : 2 18 } 19 } 20 }, 21 ... 22 }, 23 ... 24 ], 25 ... 26 }
PointRangeQueryLucene
PointRangeQueryクエリの場合、構造化されたサマリーには次の引数に関する詳細が含まれます。フィールドタイプ必要性説明path文字列
必須
検索するインデックス付きフィールド。
representation文字列
任意
数値表現。 日付型データに対するクエリには表現は含まれません。
gte番号
任意
クエリの下限。
lte番号
任意
クエリの上限。
次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "range" : { 7 "path" : "number_of_reviews", 8 "gt" : 5 9 } 10 }, 11 "explain" : { 12 "type" : "BooleanQuery", 13 "args" : { 14 "must" : [ ], 15 "mustNot" : [ ], 16 "should" : [ 17 { 18 "type" : "PointRangeQuery", 19 "args" : { 20 "path" : "number_of_reviews", 21 "representation" : "double", 22 "gte" : 5.000000000000001 23 } 24 }, 25 { 26 "type" : "PointRangeQuery", 27 "args" : { 28 "path" : "number_of_reviews", 29 "representation" : "int64", 30 "gte" : NumberLong(6) 31 } 32 } 33 ], 34 "filter" : [ ], 35 "minimumShouldMatch" : 0 36 } 37 } 38 }, 39 ... 40 }, 41 ... 42 ], 43 ... 44 }
TermQueryターム クエリの場合、構造化されたサマリーには次の引数に関する詳細が含まれます。
フィールドタイプ必要性説明path文字列
必須
検索するインデックス付きフィールド。
value文字列
必須
検索する string。
次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "queryString" : { 7 "defaultPath" : "summary", 8 "query" : "quiet" 9 } 10 }, 11 "explain" : { 12 "type" : "TermQuery", 13 "args" : { 14 "path" : "summary", 15 "value" : "quiet" 16 } 17 } 18 }, 19 ... 20 }, 21 ... 22 ], 23 ... 24 }
Default別の Lucene クエリによって明示的に定義されていない Lucene クエリは、デフォルトのクエリを使用して直列化されます。 構造化されたサマリーには、次のオプションの詳細が含まれます。
フィールドタイプ必要性説明queryType文字列
必須。
Lucene クエリのタイプ。
次の例では、
sample_airbnb.listingsAndReviewsコレクションに対してクエリを実行した場合のexplain応答を示しています。1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "near" : { 7 "origin" : { 8 "type" : "Point", 9 "coordinates" : [ 10 -8.61308, 11 41.1413 12 ] 13 }, 14 "pivot" : 1000, 15 "path" : "address.location" 16 } 17 }, 18 "explain" : { 19 "type" : "DefaultQuery", 20 "args" : { 21 "queryType" : "LatLonPointDistanceFeatureQuery" 22 } 23 } 24 }, 25 ... 26 }, 27 ... 28 ], 29 ... 30 }
stats
The explain response for executionStats and allPlansExecution verbosity modes includes a stats field that contains information on how much time a query spends in various stages of query execution.
タイミングの内訳
The timing breakdown describes execution statistics pertinent to an areas of query execution. The following fields show the timing breakdown:
フィールド | タイプ | 説明 |
|---|---|---|
| Long | |
| ドキュメント | Number of invocations of tasks included in this area. The value is a map of task names to their invocation count. |
クエリの領域
統計は、クエリの次の領域で利用できます。
オプション | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|
| Lucene クエリの実行に関連する統計。 この領域には、呼び出し回数が列挙されるタスクが 2 つあります。
The time spent in this area is related to the structure of the query, and is not based on the number of results that are iterated through and scored. 以下に例を挙げます。 | |||||||
| 結果ドキュメントの反復処理と一致に関連する統計。 この統計は、どのドキュメントが次の一致であるかを決定するのにかかる時間を示しています。 結果のマッチングに費やされる時間は、クエリの性質によって大きく異なる場合があります。 この領域には、呼び出し回数が列挙されるタスクが 2 つあります。
以下に例を挙げます。 | |||||||
| 結果セット内のドキュメントのスコアリングに関連する統計。 この領域には、呼び出し回数が列挙されるタスクが 2 つあります。
以下に例を挙げます。 |
resultMaterialization
resultMaterialization ドキュメントは、mongot が次の操作を実行するのにかかる時間を示しています。
Lucene に保存されている結果データを
_idまたはstoredSourceの形式で検索します。mongodに送信する前に、データを BSON 形式にシリアル化してください。
To learn more, see stats.
resourceUsage
resourceUsage ドキュメントには、クエリの実行に使用されるリソースが表示されます。次のフィールドが含まれています。
フィールド | タイプ | 必要性 | 目的 |
|---|---|---|---|
| Long | 必須 | クエリ実行中にシステムがメモリ内で必要なデータを見つけられず、ディスクなどのバッキング ストアから読み込む場合に発生するメジャーなページ フォールトの数。 |
| Long | 必須 | データがページキャッシュにあるが、まだプロセスのページテーブルにマップされていない場合に発生するマイナーページフォールトの数。 |
| Long | 必須 | ユーザー空間で費やされた CPU 時間(ミリ秒単位)。 |
| Long | 必須 | システム空間で費やされた CPU 時間(ミリ秒単位)。 |
| 整数 | 必須 | すべてのバッチでのクエリ実行中に |
| 整数 | 必須 | クエリのプロセシング中に |
例
次の例えでは、sample_mflix データベースの movies コレクションを使用します。
Tip
If you've already loaded the sample dataset, refer to the MongoDB Search Quick Start tutorial to create an index definition and run MongoDB Search queries.
allPlansExecution
次の例では、さまざまな演算子を使用して、title フィールドを allPlansExecution 冗長モードでクエリします。
db.movies.explain("allPlansExecution").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
db.movies.explain("allPlansExecution").aggregate([ { $search: { "text": { "path": "title", "query": "prince" }, "highlight": { "path": "title", "maxNumPassages": 1, "maxCharsToExamine": 40 } } }, { $project: { "description": 1, "_id": 0, "highlights": { "$meta": "searchHighlights" } } } ])
db.movies.explain("allPlansExecution").aggregate([ { "$searchMeta": { "facet": { "operator": { "near": { "path": "released", "origin": ISODate("1921-11-01T00:00:00.000+00:00"), "pivot": 7776000000 } }, "facets": { "genresFacet": { "type": "string", "path": "genres" }, "yearFacet" : { "type" : "number", "path" : "year", "boundaries" : [1910,1920,1930,1940] } } } } } ])
db.movies.explain("allPlansExecution").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
queryPlanner
次の例では、さまざまな演算子を使用して、title フィールドを queryPlanner 冗長モードでクエリします。
db.movies.explain("queryPlanner").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
db.movies.explain("queryPlanner").aggregate([ { $search: { "text": { "path": "title", "query": "prince" }, "highlight": { "path": "title", "maxNumPassages": 1, "maxCharsToExamine": 40 } } }, { $project: { "description": 1, "_id": 0, "highlights": { "$meta": "searchHighlights" } } } ])
db.movies.explain("queryPlanner").aggregate([ { "$searchMeta": { "facet": { "operator": { "near": { "path": "released", "origin": ISODate("1921-11-01T00:00:00.000+00:00"), "pivot": 7776000000 } }, "facets": { "genresFacet": { "type": "string", "path": "genres" }, "yearFacet" : { "type" : "number", "path" : "year", "boundaries" : [1910,1920,1930,1940] } } } } } ])
db.movies.explain("queryPlanner").aggregate([ { $search: { index: "default", range: { path: "released", gt: ISODate("2015-01-01T00:00:00.000Z"), lt: ISODate("2015-12-31T00:00:00.000Z") }, sort: { released: -1 } } }, { $limit: 5 }, { $project: { _id: 0, title: 1, released: 1 } } ])
For queries that specify a $limit stage in the pipeline, the explain results include the mongotDocsRequested metric, which shows the number of documents that mongod requested from mongot.
例
{ "mongotQuery": {}, "explain": {}, "limit": <int>, "sortSpec": {}, "mongotDocsRequested": <int>, }
executionStats
The following example uses the autocomplete to query the title field with the executionStats verbosity mode.
1 db.movies.explain("executionStats").aggregate([ 2 { 3 "$search": { 4 "autocomplete": { 5 "path": "title", 6 "query": "pre", 7 "fuzzy": { 8 "maxEdits": 1, 9 "prefixLength": 1, 10 "maxExpansions": 256 11 } 12 } 13 } 14 } 15 ])
explain 応答要素の詳細については、「Explain の結果」を参照してください。