쿼리 계획 및 실행 통계 조회
이 페이지의 내용
Atlas Search 쿼리 $search
메서드가 활성화된 상태에서 쿼리 실행 쿼리 계획 및 실행 통계에 대한 정보를 explain
반환합니다. 를 사용하여 쿼리 실행 하면 explain
Atlas Search 통계 및 루센 에서 쿼리 내부적으로 실행 된 방법을 설명하는 메타데이터 포함된 BSON 문서반환합니다.
구문
db.<myCollection>.explain("<verbosity>").aggregate([ { $search: { "<operator>": { "<operator-options>" } } } ])
상세
상세 모드에서는 explain
의 동작과 반환되는 정보의 양을 제어합니다. 값은 다음 중 하나일 수 있습니다.
쿼리 에 대한 실행 통계가 포함된 | |
쿼리 에 대한 실행 통계가 포함된 | |
queryPlanner(기본값) | 쿼리 계획 에 대한 정보입니다. 쿼리 에 대한 실행 통계가 포함된 |
결과 설명
explain
결과는 다음 필드가 있는 BSON 문서 입니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문서 | 옵션 | 수집기에 대한 실행 통계를 설명합니다. |
| 문서 | 옵션 | 에 대한 세부 정보는 쿼리 의 실행을 강조 표시합니다. 쿼리 에서 강조 표시를 지정한 경우에만 이 값이 반환됩니다. |
| 문서 배열 | 옵션 | 인덱스 별 파티션 세부 정보를 포함합니다. 두 개 이상의 인덱스 파티션을 구성한 경우에만 반환됩니다. |
| 문서 | 옵션 | 유용한 메타데이터 포함되어 있습니다. |
| 문서 | 옵션 | 쿼리 에 대한 실행 통계를 설명합니다. |
| 문서 | 옵션 | 쿼리 실행 후 루센 에서 문서별 데이터 검색과 관련된 세부 정보입니다. |
| 문서 | 옵션 | 쿼리가 실행되었을 때 쿼리 의 리소스 사용량을 자세히 설명합니다. |
collectors
collectors
BSON 문서 에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문서 | 필수 사항 | 쿼리 의 모든 수집기 통계입니다. 통계는 쿼리 에 사용된 모든 수집기의 최대값을 나타내며 모든 하위 수집기의 합계입니다. 타이밍 통계는 전체 쿼리 에 대해 모든 수집기에서 소요된 총 시간을 반영하기 위해 합산됩니다. 자세한 |
| 문서 | 옵션 | |
| 문서 | 옵션 |
allCollectorStats
BSON 문서 및 를 포함하여 쿼리 에 지정된 모든 수집기에 대한 수집기 통계를 allCollectorStats
facet
sort
설명합니다. 여기에는 다음과 같은 키가 포함되어 있습니다.
| 수집기가 수집한 결과의 기간과 수를 추적합니다. |
| 수집기에서 |
| 수집기에 기록자가 설정하다 총 기간과 횟수를 추적하는 통계입니다. |
facet
은(는 facet
) 쿼리 에서 패싯 지정할 때 쿼리 및 실행 통계를 자세히 설명하는 BSON 문서 입니다. 여기에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문서 | 옵션 |
|
| 문서 | 옵션 | 모든 패싯 그룹을 보유하는 내부 루센 객체 생성과 관련된 통계를 표시합니다. 여기에는 |
| 문서 | 필수 사항 | 쿼리 와 일치하는 문서와 전체 루센 인덱스 모두에 대해 패싯 처리되는 필드 카디널리티에 매핑합니다. 각 필드 에 대해 다음과 같은 카디널리티 정보를 제공합니다.
|
sort
은(는 sort
) 쿼리 에서 정렬을 지정할 때 쿼리 및 실행 통계를 자세히 설명하는 BSON 문서 입니다. 여기에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문서 | 옵션 | 모든 정렬 필드에서
|
| 문서 | 필수 사항 | 정렬 중인 필드 필드 의 인덱스 에 있는 데이터 유형 목록에 매핑합니다. |
highlight
은(는 highlight
) 쿼리 에서 강조 표시를 지정할 때 쿼리 및 실행 통계를 자세히 설명하는 BSON 문서 입니다. 여기에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| List<String> | 필수 사항 | 강조 표시된 모든 필드의 목록입니다. 쿼리 의 |
| QueryExecutionArea | 옵션 | 하이라이트 설정 및 실행과 관련된 호출 및 타이밍 통계입니다. 여기에는 다음 필드가 포함되어 있습니다.
|
indexPartitionExplain
에는 indexPartitionExplain
각 인덱스 파티션에 대한 Explain 결과가 collectors
포함되어 있습니다. 최상위 수준 및 query
는 explain
각 인덱스 파티션의 정보 내에 있으며 최상위 수준에는 없습니다.
metadata
metadata
에는 다음과 같은 유용한 메타데이터 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문자열 | 옵션 |
|
| 문자열 | 옵션 |
|
| 문자열 | 옵션 | 쿼리 에 사용된 Atlas Search 인덱스 . |
| 문서 | 옵션 | mongot 에 커서 옵션이 제공됩니다. |
| Integer | 옵션 | 삭제된 문서를 포함하여 인덱스 에 있는 인덱스 객체의 총 개수입니다. |
query
query
BSON 문서 쿼리 에 대한 실행 통계를 설명합니다. 여기에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| 문자열 | 옵션 | 연산자의 경로(루트가 아닌 경우에만). |
| 문자열 | 필수 사항 | Atlas Search 연산자 생성한 루센 쿼리의 이름입니다. 자세한 내용은 |
| 문자열 | 옵션 | 쿼리와 함께 사용된 Atlas Search 분석기 입니다. |
| 문서 | 필수 사항 | 루센 쿼리 정보입니다. 자세한 내용은 |
| 문서 | 옵션 |
|
args
검색 명령의 설명 응답에는 해당 명령으로 실행된 쿼리 에 대한 정보가 포함되어 있습니다.args
필드 의 응답에는 쿼리 충족하기 위해 Atlas Search 실행한 루센 쿼리에 대한 구조화된 세부 정보가 포함되어 $search
있습니다.
이 섹션에는 다음이 포함됩니다.
Atlas Search 연산자가 생성하는 일부 루센 쿼리
구조화된 요약에 포함된 루센 쿼리 옵션
각 루센 쿼리 유형에 대한 루센 쿼리 구조화된 요약 예시
참고
예시 정보
이 섹션의 예제는 queryPlanner
상세도 모드 사용하여 샘플 데이터 세트에 대해 실행 쿼리를 기반으로 합니다. 예시 응답에서는 다음과 같습니다.
mongotQuery
필드에는 Atlas Search 연산자와 실행된 쿼리가 표시됩니다.explain.type
필드에는 연산자가 만든 루센 쿼리가 표시됩니다.
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 }
FunctionScoreQuery
루센
FunctionScoreQuery
쿼리의 경우 구조화된 요약에 다음 옵션에 대한 세부 정보가 포함되어 있습니다.필드유형필요성설명scoreFunction
문자열
필수 사항
쿼리에 사용된 점수 표현식입니다.
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 }
LatLonPointDistanceQuery
루센
LatLonPointDistanceQuery
쿼리의 경우 응답에는 만stats
포함됩니다.다음 예제에서는
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 }
LatLonShapeQuery
루센
LatLonShapeQuery
쿼리의 경우 응답에는 만stats
포함됩니다.다음 예제에서는
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 }
LongDistanceFeatureQuery
루센 의
LongDistanceFeatureQuery
경우 응답에 만stats
포함됩니다.다음 예제에서는
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 }
MultiTermQueryConstantScoreWrapper
다음 예제에서는
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 }
PhraseQuery
루센
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 }
PointRangeQuery
루센
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
문자열
필수 사항
검색할 문자열입니다.
다음 예제에서는
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
다른 루센 쿼리에서 명시적으로 정의되지 않은 루센 쿼리는 기본 쿼리를 사용하여 직렬화됩니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.
필드유형필요성설명queryType
문자열
필수 사항입니다.
루씬 쿼리 유형.
다음 예제에서는
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
executionStats 및 allPlansExecution 상세도 모드에 대한 explain
응답에는 stats
쿼리가 쿼리 실행의 다양한 단계 에서 소비하는 시간 에 대한 정보가 포함된 필드가 포함되어 있습니다.
타이밍 분석
타이밍 분석 은 쿼리 실행 영역과 관련된 실행 통계를 설명합니다. 다음 필드에는 타이밍 분석이 표시됩니다.
쿼리 영역
다음 쿼리 영역에 대한 통계를 사용할 수 있습니다.
resultMaterialization
resultMaterialization
문서 mongot
이 다음을 수행하는 데 걸리는 시간을 보여줍니다.
_id
또는storedSource
형식으로 루센 에 저장된 결과 데이터를 조회합니다.데이터를 로 전송하기 전에 BSON 형식으로
mongod
직렬화합니다.
자세한 학습 은 를 stats
참조하세요.
resourceUsage
resourceUsage
문서 쿼리 실행 데 사용되는 리소스 보여줍니다. 여기에는 다음 필드가 포함되어 있습니다.
옵션 | 유형 | 필요성 | 목적 |
---|---|---|---|
| Long | 필수 사항 | 쿼리 실행 중에 시스템이 메모리에서 필요한 데이터를 찾지 못해 디스크와 같은 백업 저장 에서 데이터를 읽을 때 발생하는 주요 페이지 오류의 수입니다. |
| Long | 필수 사항 | 데이터가 페이지 캐시 에 있지만 아직 프로세스 의 페이지 테이블에 매핑되지 않았을 때 발생하는 사소한 페이지 오류의 수입니다. |
| Long | 필수 사항 | 사용자 공간에서 소비한 CPU 시간(단위: 밀리초)입니다. |
| Long | 필수 사항 | 시스템 공간에서 소비한 CPU 시간(단위: 밀리초)입니다. |
| Integer | 필수 사항 | 모든 배치에서 |
| Integer | 필수 사항 | 쿼리 처리 때 |
예시
다음 예시에서는 sample_mflix
데이터베이스의 movies
컬렉션을 사용합니다.
팁
샘플 데이터 집합을 이미 로드한 경우, Atlas Search 시작하기 자습서에 따라 인덱스 정의를 만들고 Atlas Search 쿼리를 실행하세요.
allPlansExecution
다음 예시 다양한 연산자를 사용하여 상세도 title
allPlansExecution
모드 로 필드 쿼리 .
db.movies.explain("allPlansExecution").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$_internalSearchMongotRemote': { 6 mongotQuery: { 7 text: { 8 path: 'title', 9 query: 'yark', 10 fuzzy: { maxEdits: 1, maxExpansions: 100 } 11 } 12 }, 13 explain: { 14 query: { 15 type: 'BooleanQuery', 16 args: { 17 must: [], 18 mustNot: [], 19 should: [ 20 { 21 type: 'BoostQuery', 22 args: { 23 query: { 24 type: 'TermQuery', 25 args: { path: 'title', value: 'dark' }, 26 stats: { 27 context: { millisElapsed: 0 }, 28 match: { millisElapsed: 0 }, 29 score: { millisElapsed: 0 } 30 } 31 }, 32 boost: 0.75 33 }, 34 stats: { 35 context: { 36 millisElapsed: 0.403983, 37 invocationCounts: { 38 createWeight: Long('1'), 39 createScorer: Long('18') 40 } 41 }, 42 match: { 43 millisElapsed: 0.094254, 44 invocationCounts: { nextDoc: Long('89') } 45 }, 46 score: { 47 millisElapsed: 0.077043, 48 invocationCounts: { score: Long('83') } 49 } 50 } 51 }, 52 { 53 type: 'BoostQuery', 54 args: { 55 query: { 56 type: 'TermQuery', 57 args: { path: 'title', value: 'ark' }, 58 stats: { 59 context: { millisElapsed: 0 }, 60 match: { millisElapsed: 0 }, 61 score: { millisElapsed: 0 } 62 } 63 }, 64 boost: 0.6666666269302368 65 }, 66 stats: { 67 context: { 68 millisElapsed: 0.248528, 69 invocationCounts: { 70 createWeight: Long('1'), 71 createScorer: Long('8') 72 } 73 }, 74 match: { 75 millisElapsed: 0.067561, 76 invocationCounts: { nextDoc: Long('3') } 77 }, 78 score: { 79 millisElapsed: 0.001649, 80 invocationCounts: { score: Long('2') } 81 } 82 } 83 }, 84 { 85 type: 'BoostQuery', 86 args: { 87 query: { 88 type: 'TermQuery', 89 args: { path: 'title', value: 'mark' }, 90 stats: { 91 context: { millisElapsed: 0 }, 92 match: { millisElapsed: 0 }, 93 score: { millisElapsed: 0 } 94 } 95 }, 96 boost: 0.75 97 }, 98 stats: { 99 context: { 100 millisElapsed: 0.337083, 101 invocationCounts: { 102 createWeight: Long('1'), 103 createScorer: Long('12') 104 } 105 }, 106 match: { 107 millisElapsed: 0.006489, 108 invocationCounts: { nextDoc: Long('11') } 109 }, 110 score: { 111 millisElapsed: 0.013741, 112 invocationCounts: { score: Long('8') } 113 } 114 } 115 }, 116 { 117 type: 'BoostQuery', 118 args: { 119 query: { 120 type: 'TermQuery', 121 args: { path: 'title', value: 'park' }, 122 stats: { 123 context: { millisElapsed: 0 }, 124 match: { millisElapsed: 0 }, 125 score: { millisElapsed: 0 } 126 } 127 }, 128 boost: 0.75 129 }, 130 stats: { 131 context: { 132 millisElapsed: 0.395528, 133 invocationCounts: { 134 createWeight: Long('1'), 135 createScorer: Long('16') 136 } 137 }, 138 match: { 139 millisElapsed: 0.091681, 140 invocationCounts: { nextDoc: Long('32') } 141 }, 142 score: { 143 millisElapsed: 0.137827, 144 invocationCounts: { score: Long('27') } 145 } 146 } 147 }, 148 { 149 type: 'BoostQuery', 150 args: { 151 query: { 152 type: 'TermQuery', 153 args: { path: 'title', value: 'york' }, 154 stats: { 155 context: { millisElapsed: 0 }, 156 match: { millisElapsed: 0 }, 157 score: { millisElapsed: 0 } 158 } 159 }, 160 boost: 0.75 161 }, 162 stats: { 163 context: { 164 millisElapsed: 0.150681, 165 invocationCounts: { 166 createWeight: Long('1'), 167 createScorer: Long('16') 168 } 169 }, 170 match: { 171 millisElapsed: 0.067298, 172 invocationCounts: { nextDoc: Long('33') } 173 }, 174 score: { 175 millisElapsed: 0.038636, 176 invocationCounts: { score: Long('28') } 177 } 178 } 179 }, 180 { 181 type: 'BoostQuery', 182 args: { 183 query: { 184 type: 'TermQuery', 185 args: { path: 'title', value: 'yard' }, 186 stats: { 187 context: { millisElapsed: 0 }, 188 match: { millisElapsed: 0 }, 189 score: { millisElapsed: 0 } 190 } 191 }, 192 boost: 0.75 193 }, 194 stats: { 195 context: { 196 millisElapsed: 0.104308, 197 invocationCounts: { 198 createWeight: Long('1'), 199 createScorer: Long('8') 200 } 201 }, 202 match: { 203 millisElapsed: 0.002445, 204 invocationCounts: { nextDoc: Long('4') } 205 }, 206 score: { 207 millisElapsed: 0.00233, 208 invocationCounts: { score: Long('3') } 209 } 210 } 211 } 212 ], 213 filter: [], 214 minimumShouldMatch: 0 215 }, 216 stats: { 217 context: { 218 millisElapsed: 12.8127, 219 invocationCounts: { createWeight: Long('1'), createScorer: Long('12') } 220 }, 221 match: { 222 millisElapsed: 0.761076, 223 invocationCounts: { nextDoc: Long('157') } 224 }, 225 score: { 226 millisElapsed: 0.857125, 227 invocationCounts: { score: Long('151') } 228 } 229 } 230 }, 231 collectors: { 232 allCollectorStats: { 233 millisElapsed: 2.061296, 234 invocationCounts: { 235 collect: Long('151'), 236 competitiveIterator: Long('6'), 237 setScorer: Long('6') 238 } 239 }, 240 facet: { collectorStats: { millisElapsed: 0 } } 241 }, 242 resultMaterialization: { 243 stats: { 244 millisElapsed: 17.759502, 245 invocationCounts: { retrieveAndSerialize: Long('1') } 246 } 247 }, 248 metadata: { 249 mongotVersion: '1.43.1', 250 mongotHostName: '<hostname>.mogodb.net', 251 indexName: 'default', 252 totalLuceneDocs: 21349 253 }, 254 resourceUsage: { 255 majorFaults: Long('0'), 256 minorFaults: Long('98'), 257 userTimeMs: Long('30'), 258 systemTimeMs: Long('0'), 259 maxReportingThreads: 1, 260 numBatches: 1 261 } 262 }, 263 requiresSearchMetaCursor: true 264 }, 265 nReturned: Long('0'), 266 executionTimeMillisEstimate: Long('108') 267 }, 268 { 269 '$_internalSearchIdLookup': {}, 270 nReturned: Long('0'), 271 executionTimeMillisEstimate: Long('108') 272 } 273 ], 274 queryShapeHash: '6FD3791F785FA329D4ECD1171E0E5AF6772C18F5F0A7A50FC416D080A93C8CB7', 275 serverInfo: { 276 host: '<hostname>.mogodb.net', 277 port: 27017, 278 version: '8.0.4', 279 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 280 }, 281 serverParameters: { 282 ... 283 }, 284 command: { 285 aggregate: 'movies', 286 pipeline: [ 287 { 288 '$search': { 289 text: { 290 path: 'title', 291 query: 'yark', 292 fuzzy: { maxEdits: 1, maxExpansions: 100 } 293 } 294 } 295 } 296 ], 297 cursor: {}, 298 '$db': 'sample_mflix' 299 }, 300 ok: 1, 301 '$clusterTime': { 302 clusterTime: Timestamp({ t: 1738081279, i: 12 }), 303 signature: { 304 hash: Binary.createFromBase64('DM3imkEw1qT23M2n/b/JibqB1Fg=', 0), 305 keyId: Long('7462787091647168517') 306 } 307 }, 308 operationTime: Timestamp({ t: 1738081279, i: 12 }) 309 }
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" } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$_internalSearchMongotRemote': { 6 mongotQuery: { 7 text: { path: 'title', query: 'prince' }, 8 highlight: { path: 'title', maxNumPassages: 1, maxCharsToExamine: 40 } 9 }, 10 explain: { 11 query: { 12 type: 'TermQuery', 13 args: { path: 'title', value: 'prince' }, 14 stats: { 15 context: { 16 millisElapsed: 1.034149, 17 invocationCounts: { createWeight: Long('1'), createScorer: Long('10') } 18 }, 19 match: { 20 millisElapsed: 0.050591, 21 invocationCounts: { nextDoc: Long('29') } 22 }, 23 score: { 24 millisElapsed: 0.027259, 25 invocationCounts: { score: Long('25') } 26 } 27 } 28 }, 29 collectors: { 30 allCollectorStats: { 31 millisElapsed: 0.112751, 32 invocationCounts: { 33 collect: Long('25'), 34 competitiveIterator: Long('4'), 35 setScorer: Long('4') 36 } 37 }, 38 facet: { collectorStats: { millisElapsed: 0 } } 39 }, 40 highlight: { 41 resolvedHighlightPaths: [ '$type:string/title' ], 42 stats: { 43 millisElapsed: 10.665238, 44 invocationCounts: { 45 executeHighlight: Long('1'), 46 setupHighlight: Long('1') 47 } 48 } 49 }, 50 resultMaterialization: { 51 stats: { 52 millisElapsed: 3.548075, 53 invocationCounts: { retrieveAndSerialize: Long('1') } 54 } 55 }, 56 metadata: { 57 mongotVersion: '1.43.1', 58 mongotHostName: '<hostname>.mongodb.net', 59 indexName: 'default', 60 totalLuceneDocs: 21349 61 }, 62 resourceUsage: { 63 majorFaults: Long('0'), 64 minorFaults: Long('0'), 65 userTimeMs: Long('10'), 66 systemTimeMs: Long('0'), 67 maxReportingThreads: 1, 68 numBatches: 1 69 } 70 }, 71 requiresSearchMetaCursor: true 72 }, 73 nReturned: Long('0'), 74 executionTimeMillisEstimate: Long('31') 75 }, 76 { 77 '$_internalSearchIdLookup': {}, 78 nReturned: Long('0'), 79 executionTimeMillisEstimate: Long('31') 80 }, 81 { 82 '$project': { 83 description: true, 84 highlights: { '$meta': 'searchHighlights' }, 85 _id: false 86 }, 87 nReturned: Long('0'), 88 executionTimeMillisEstimate: Long('31') 89 } 90 ], 91 queryShapeHash: 'D08444272924C1E04A6E99D0CD4BF82FD929893862B3356F79EC18BBD1F0EF0C', 92 serverInfo: { 93 host: '<hostname>.mogodb.net', 94 port: 27017, 95 version: '8.0.4', 96 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 97 }, 98 serverParameters: { 99 internalQueryFacetBufferSizeBytes: 104857600, 100 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 101 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 102 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 103 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 104 internalQueryProhibitBlockingMergeOnMongoS: 0, 105 internalQueryMaxAddToSetBytes: 104857600, 106 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 107 internalQueryFrameworkControl: 'trySbeRestricted', 108 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 109 }, 110 command: { 111 aggregate: 'movies', 112 pipeline: [ 113 { 114 '$search': { 115 text: { path: 'title', query: 'prince' }, 116 highlight: { path: 'title', maxNumPassages: 1, maxCharsToExamine: 40 } 117 } 118 }, 119 { 120 '$project': { 121 description: 1, 122 _id: 0, 123 highlights: { '$meta': 'searchHighlights' } 124 } 125 } 126 ], 127 cursor: {}, 128 '$db': 'sample_mflix' 129 }, 130 ok: 1, 131 '$clusterTime': { 132 clusterTime: Timestamp({ t: 1738081637, i: 1 }), 133 signature: { 134 hash: Binary.createFromBase64('TnFwebZsmrjLunk7/TN+9rfJ/8Y=', 0), 135 keyId: Long('7462787091647168517') 136 } 137 }, 138 operationTime: Timestamp({ t: 1738081637, i: 1 }) 139 }
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] } } } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$searchMeta': { 6 mongotQuery: { 7 facet: { 8 operator: { 9 near: { 10 path: 'released', 11 origin: ISODate('1921-11-01T00:00:00.000Z'), 12 pivot: 7776000000 13 } 14 }, 15 facets: { 16 genresFacet: { type: 'string', path: 'genres' }, 17 yearFacet: { 18 type: 'number', 19 path: 'year', 20 boundaries: [ 1910, 1920, 1930, 1940 ] 21 } 22 } 23 } 24 }, 25 explain: { 26 query: { 27 type: 'LongDistanceFeatureQuery', 28 args: {}, 29 stats: { 30 context: { 31 millisElapsed: 0.684076, 32 invocationCounts: { createWeight: Long('1'), createScorer: Long('12') } 33 }, 34 match: { 35 millisElapsed: 1.285512, 36 invocationCounts: { nextDoc: Long('20884') } 37 }, 38 score: { 39 millisElapsed: 1.321738, 40 invocationCounts: { score: Long('20878') } 41 } 42 } 43 }, 44 collectors: { 45 allCollectorStats: { 46 millisElapsed: 10.536043, 47 invocationCounts: { 48 collect: Long('20878'), 49 competitiveIterator: Long('6'), 50 setScorer: Long('6') 51 } 52 }, 53 facet: { 54 collectorStats: { 55 millisElapsed: 3.730834, 56 invocationCounts: { collect: Long('20878'), setScorer: Long('6') } 57 }, 58 createCountsStats: { 59 millisElapsed: 10.350302, 60 invocationCounts: { generateFacetCounts: Long('2') } 61 }, 62 stringFacetCardinalities: { genresFacet: { queried: 10, total: 25 } } 63 } 64 }, 65 resultMaterialization: { 66 stats: { 67 millisElapsed: 10.645713, 68 invocationCounts: { retrieveAndSerialize: Long('1') } 69 } 70 }, 71 metadata: { 72 mongotVersion: '1.43.1', 73 mongotHostName: '<hostname>.mogodb.net', 74 indexName: 'default', 75 totalLuceneDocs: 21349 76 }, 77 resourceUsage: { 78 majorFaults: Long('0'), 79 minorFaults: Long('0'), 80 userTimeMs: Long('10'), 81 systemTimeMs: Long('0'), 82 maxReportingThreads: 1, 83 numBatches: 1 84 } 85 }, 86 requiresSearchMetaCursor: true 87 }, 88 nReturned: Long('0'), 89 executionTimeMillisEstimate: Long('57') 90 } 91 ], 92 queryShapeHash: '582DB864C9BCFB96896CF1A3079CF70FAC10A9A1E19E8D66DF20A2BB40424FB5', 93 serverInfo: { 94 host: '<hostname>.mogodb.net', 95 port: 27017, 96 version: '8.0.4', 97 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 98 }, 99 serverParameters: { 100 internalQueryFacetBufferSizeBytes: 104857600, 101 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 102 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 103 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 104 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 105 internalQueryProhibitBlockingMergeOnMongoS: 0, 106 internalQueryMaxAddToSetBytes: 104857600, 107 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 108 internalQueryFrameworkControl: 'trySbeRestricted', 109 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 110 }, 111 command: { 112 aggregate: 'movies', 113 pipeline: [ 114 { 115 '$searchMeta': { 116 facet: { 117 operator: { 118 near: { 119 path: 'released', 120 origin: ISODate('1921-11-01T00:00:00.000Z'), 121 pivot: 7776000000 122 } 123 }, 124 facets: { 125 genresFacet: { type: 'string', path: 'genres' }, 126 yearFacet: { 127 type: 'number', 128 path: 'year', 129 boundaries: [ 1910, 1920, 1930, 1940 ] 130 } 131 } 132 } 133 } 134 } 135 ], 136 cursor: {}, 137 '$db': 'sample_mflix' 138 }, 139 ok: 1, 140 '$clusterTime': { 141 clusterTime: Timestamp({ t: 1738081767, i: 1 }), 142 signature: { 143 hash: Binary.createFromBase64('ieRjqe84DdOnmlCcP3XBelo8vyM=', 0), 144 keyId: Long('7462787091647168517') 145 } 146 }, 147 operationTime: Timestamp({ t: 1738081767, i: 1 }) 148 }
db.movies.explain("allPlansExecution").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$_internalSearchMongotRemote': { 6 mongotQuery: { 7 text: { 8 path: 'title', 9 query: 'yark', 10 fuzzy: { maxEdits: 1, maxExpansions: 100 } 11 } 12 }, 13 explain: { 14 metadata: { 15 mongotVersion: '1.43.2', 16 mongotHostName: '<hostname>.mongodb.net', 17 indexName: 'default' 18 }, 19 resourceUsage: { 20 majorFaults: Long('0'), 21 minorFaults: Long('90'), 22 userTimeMs: Long('20'), 23 systemTimeMs: Long('0'), 24 maxReportingThreads: 1, 25 numBatches: 1 26 }, 27 indexPartitionExplain: [ 28 { 29 query: { 30 type: 'BooleanQuery', 31 args: { 32 must: [], 33 mustNot: [], 34 should: [ 35 { 36 type: 'BoostQuery', 37 args: { 38 query: { 39 type: 'TermQuery', 40 args: { path: 'title', value: 'dark' }, 41 stats: { 42 context: { millisElapsed: 0 }, 43 match: { millisElapsed: 0 }, 44 score: { millisElapsed: 0 } 45 } 46 }, 47 boost: 0.75 48 }, 49 stats: { 50 context: { 51 millisElapsed: 0.035132, 52 invocationCounts: { 53 createWeight: Long('1'), 54 createScorer: Long('3') 55 } 56 }, 57 match: { 58 millisElapsed: 0.067392, 59 invocationCounts: { nextDoc: Long('50') } 60 }, 61 score: { 62 millisElapsed: 0.032873, 63 invocationCounts: { score: Long('49') } 64 } 65 } 66 }, 67 { 68 type: 'BoostQuery', 69 args: { 70 query: { 71 type: 'TermQuery', 72 args: { path: 'title', value: 'park' }, 73 stats: { 74 context: { millisElapsed: 0 }, 75 match: { millisElapsed: 0 }, 76 score: { millisElapsed: 0 } 77 } 78 }, 79 boost: 0.75 80 }, 81 stats: { 82 context: { 83 millisElapsed: 0.025347, 84 invocationCounts: { 85 createWeight: Long('1'), 86 createScorer: Long('3') 87 } 88 }, 89 match: { 90 millisElapsed: 0.012782, 91 invocationCounts: { nextDoc: Long('16') } 92 }, 93 score: { 94 millisElapsed: 0.007131, 95 invocationCounts: { score: Long('15') } 96 } 97 } 98 }, 99 { 100 type: 'BoostQuery', 101 args: { 102 query: { 103 type: 'TermQuery', 104 args: { path: 'title', value: 'mark' }, 105 stats: { 106 context: { millisElapsed: 0 }, 107 match: { millisElapsed: 0 }, 108 score: { millisElapsed: 0 } 109 } 110 }, 111 boost: 0.75 112 }, 113 stats: { 114 context: { 115 millisElapsed: 0.028604, 116 invocationCounts: { 117 createWeight: Long('1'), 118 createScorer: Long('3') 119 } 120 }, 121 match: { 122 millisElapsed: 0.001842, 123 invocationCounts: { nextDoc: Long('4') } 124 }, 125 score: { 126 millisElapsed: 0.001571, 127 invocationCounts: { score: Long('3') } 128 } 129 } 130 }, 131 { 132 type: 'BoostQuery', 133 args: { 134 query: { 135 type: 'TermQuery', 136 args: { path: 'title', value: 'yard' }, 137 stats: { 138 context: { millisElapsed: 0 }, 139 match: { millisElapsed: 0 }, 140 score: { millisElapsed: 0 } 141 } 142 }, 143 boost: 0.75 144 }, 145 stats: { 146 context: { 147 millisElapsed: 0.02443, 148 invocationCounts: { 149 createWeight: Long('1'), 150 createScorer: Long('3') 151 } 152 }, 153 match: { 154 millisElapsed: 0.001531, 155 invocationCounts: { nextDoc: Long('3') } 156 }, 157 score: { 158 millisElapsed: 0.001065, 159 invocationCounts: { score: Long('2') } 160 } 161 } 162 }, 163 { 164 type: 'BoostQuery', 165 args: { 166 query: { 167 type: 'TermQuery', 168 args: { path: 'title', value: 'ark' }, 169 stats: { 170 context: { millisElapsed: 0 }, 171 match: { millisElapsed: 0 }, 172 score: { millisElapsed: 0 } 173 } 174 }, 175 boost: 0.6666666269302368 176 }, 177 stats: { 178 context: { 179 millisElapsed: 0.087657, 180 invocationCounts: { 181 createWeight: Long('1'), 182 createScorer: Long('3') 183 } 184 }, 185 match: { 186 millisElapsed: 0.001745, 187 invocationCounts: { nextDoc: Long('2') } 188 }, 189 score: { 190 millisElapsed: 0.000471, 191 invocationCounts: { score: Long('1') } 192 } 193 } 194 }, 195 { 196 type: 'BoostQuery', 197 args: { 198 query: { 199 type: 'TermQuery', 200 args: { path: 'title', value: 'york' }, 201 stats: { 202 context: { millisElapsed: 0 }, 203 match: { millisElapsed: 0 }, 204 score: { millisElapsed: 0 } 205 } 206 }, 207 boost: 0.75 208 }, 209 stats: { 210 context: { 211 millisElapsed: 0.024546, 212 invocationCounts: { 213 createWeight: Long('1'), 214 createScorer: Long('3') 215 } 216 }, 217 match: { 218 millisElapsed: 0.01154, 219 invocationCounts: { nextDoc: Long('15') } 220 }, 221 score: { 222 millisElapsed: 0.006867, 223 invocationCounts: { score: Long('14') } 224 } 225 } 226 } 227 ], 228 filter: [], 229 minimumShouldMatch: 0 230 }, 231 stats: { 232 context: { 233 millisElapsed: 0.337917, 234 invocationCounts: { 235 createWeight: Long('1'), 236 createScorer: Long('2') 237 } 238 }, 239 match: { 240 millisElapsed: 0.165335, 241 invocationCounts: { nextDoc: Long('85') } 242 }, 243 score: { 244 millisElapsed: 0.098247, 245 invocationCounts: { score: Long('84') } 246 } 247 } 248 }, 249 collectors: { 250 allCollectorStats: { 251 millisElapsed: 0.205935, 252 invocationCounts: { 253 collect: Long('84'), 254 competitiveIterator: Long('1'), 255 setScorer: Long('1') 256 } 257 }, 258 facet: { collectorStats: { millisElapsed: 0 } } 259 }, 260 metadata: { totalLuceneDocs: 10635 } 261 }, 262 { 263 query: { 264 type: 'BooleanQuery', 265 args: { 266 must: [], 267 mustNot: [], 268 should: [ 269 { 270 type: 'BoostQuery', 271 args: { 272 query: { 273 type: 'TermQuery', 274 args: { path: 'title', value: 'dark' }, 275 stats: { 276 context: { millisElapsed: 0 }, 277 match: { millisElapsed: 0 }, 278 score: { millisElapsed: 0 } 279 } 280 }, 281 boost: 0.75 282 }, 283 stats: { 284 context: { 285 millisElapsed: 0.033805, 286 invocationCounts: { 287 createWeight: Long('1'), 288 createScorer: Long('3') 289 } 290 }, 291 match: { 292 millisElapsed: 0.049273, 293 invocationCounts: { nextDoc: Long('35') } 294 }, 295 score: { 296 millisElapsed: 0.023509, 297 invocationCounts: { score: Long('34') } 298 } 299 } 300 }, 301 { 302 type: 'BoostQuery', 303 args: { 304 query: { 305 type: 'TermQuery', 306 args: { path: 'title', value: 'park' }, 307 stats: { 308 context: { millisElapsed: 0 }, 309 match: { millisElapsed: 0 }, 310 score: { millisElapsed: 0 } 311 } 312 }, 313 boost: 0.75 314 }, 315 stats: { 316 context: { 317 millisElapsed: 0.025853, 318 invocationCounts: { 319 createWeight: Long('1'), 320 createScorer: Long('3') 321 } 322 }, 323 match: { 324 millisElapsed: 0.016276, 325 invocationCounts: { nextDoc: Long('13') } 326 }, 327 score: { 328 millisElapsed: 0.007533, 329 invocationCounts: { score: Long('12') } 330 } 331 } 332 }, 333 { 334 type: 'BoostQuery', 335 args: { 336 query: { 337 type: 'TermQuery', 338 args: { path: 'title', value: 'mark' }, 339 stats: { 340 context: { millisElapsed: 0 }, 341 match: { millisElapsed: 0 }, 342 score: { millisElapsed: 0 } 343 } 344 }, 345 boost: 0.75 346 }, 347 stats: { 348 context: { 349 millisElapsed: 0.027083, 350 invocationCounts: { 351 createWeight: Long('1'), 352 createScorer: Long('3') 353 } 354 }, 355 match: { 356 millisElapsed: 0.006663, 357 invocationCounts: { nextDoc: Long('6') } 358 }, 359 score: { 360 millisElapsed: 0.002944, 361 invocationCounts: { score: Long('5') } 362 } 363 } 364 }, 365 { 366 type: 'BoostQuery', 367 args: { 368 query: { 369 type: 'TermQuery', 370 args: { path: 'title', value: 'yard' }, 371 stats: { 372 context: { millisElapsed: 0 }, 373 match: { millisElapsed: 0 }, 374 score: { millisElapsed: 0 } 375 } 376 }, 377 boost: 0.75 378 }, 379 stats: { 380 context: { 381 millisElapsed: 0.025523, 382 invocationCounts: { 383 createWeight: Long('1'), 384 createScorer: Long('3') 385 } 386 }, 387 match: { 388 millisElapsed: 0.000945, 389 invocationCounts: { nextDoc: Long('2') } 390 }, 391 score: { 392 millisElapsed: 0.000558, 393 invocationCounts: { score: Long('1') } 394 } 395 } 396 }, 397 { 398 type: 'BoostQuery', 399 args: { 400 query: { 401 type: 'TermQuery', 402 args: { path: 'title', value: 'ark' }, 403 stats: { 404 context: { millisElapsed: 0 }, 405 match: { millisElapsed: 0 }, 406 score: { millisElapsed: 0 } 407 } 408 }, 409 boost: 0.6666666269302368 410 }, 411 stats: { 412 context: { 413 millisElapsed: 0.069448, 414 invocationCounts: { 415 createWeight: Long('1'), 416 createScorer: Long('3') 417 } 418 }, 419 match: { 420 millisElapsed: 0.001375, 421 invocationCounts: { nextDoc: Long('2') } 422 }, 423 score: { 424 millisElapsed: 0.000477, 425 invocationCounts: { score: Long('1') } 426 } 427 } 428 }, 429 { 430 type: 'BoostQuery', 431 args: { 432 query: { 433 type: 'TermQuery', 434 args: { path: 'title', value: 'york' }, 435 stats: { 436 context: { millisElapsed: 0 }, 437 match: { millisElapsed: 0 }, 438 score: { millisElapsed: 0 } 439 } 440 }, 441 boost: 0.75 442 }, 443 stats: { 444 context: { 445 millisElapsed: 0.025056, 446 invocationCounts: { 447 createWeight: Long('1'), 448 createScorer: Long('3') 449 } 450 }, 451 match: { 452 millisElapsed: 0.013107, 453 invocationCounts: { nextDoc: Long('15') } 454 }, 455 score: { 456 millisElapsed: 0.007251, 457 invocationCounts: { score: Long('14') } 458 } 459 } 460 } 461 ], 462 filter: [], 463 minimumShouldMatch: 0 464 }, 465 stats: { 466 context: { 467 millisElapsed: 0.292379, 468 invocationCounts: { 469 createWeight: Long('1'), 470 createScorer: Long('2') 471 } 472 }, 473 match: { 474 millisElapsed: 0.14967, 475 invocationCounts: { nextDoc: Long('68') } 476 }, 477 score: { 478 millisElapsed: 0.082494, 479 invocationCounts: { score: Long('67') } 480 } 481 } 482 }, 483 collectors: { 484 allCollectorStats: { 485 millisElapsed: 0.159291, 486 invocationCounts: { 487 collect: Long('67'), 488 competitiveIterator: Long('1'), 489 setScorer: Long('1') 490 } 491 }, 492 facet: { collectorStats: { millisElapsed: 0 } } 493 }, 494 metadata: { totalLuceneDocs: 10714 } 495 } 496 ] 497 }, 498 requiresSearchMetaCursor: true 499 }, 500 nReturned: Long('0'), 501 executionTimeMillisEstimate: Long('59') 502 }, 503 { 504 '$_internalSearchIdLookup': {}, 505 nReturned: Long('0'), 506 executionTimeMillisEstimate: Long('59') 507 } 508 ], 509 queryShapeHash: '6FD3791F785FA329D4ECD1171E0E5AF6772C18F5F0A7A50FC416D080A93C8CB7', 510 serverInfo: { 511 host: '<hostname>.mogodb.net', 512 port: 27017, 513 version: '8.0.4', 514 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 515 }, 516 serverParameters: { 517 internalQueryFacetBufferSizeBytes: 104857600, 518 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 519 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 520 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 521 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 522 internalQueryProhibitBlockingMergeOnMongoS: 0, 523 internalQueryMaxAddToSetBytes: 104857600, 524 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 525 internalQueryFrameworkControl: 'trySbeRestricted', 526 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 527 }, 528 command: { 529 aggregate: 'movies', 530 pipeline: [ 531 { 532 '$search': { 533 text: { 534 path: 'title', 535 query: 'yark', 536 fuzzy: { maxEdits: 1, maxExpansions: 100 } 537 } 538 } 539 } 540 ], 541 cursor: {}, 542 '$db': 'sample_mflix' 543 }, 544 ok: 1, 545 '$clusterTime': { 546 clusterTime: Timestamp({ t: 1739918308, i: 1 }), 547 signature: { 548 hash: Binary.createFromBase64('D0UjelHYrLf3bfSMxrfVbgVtcIw=', 0), 549 keyId: Long('7470183785540091909') 550 } 551 }, 552 operationTime: Timestamp({ t: 1739918308, i: 1 }) 553 }
queryPlanner
다음 예시 다양한 연산자를 사용하여 상세도 title
queryPlanner
모드 로 필드 쿼리 .
db.movies.explain("queryPlanner").aggregate([ { $search: { "text": { "path": "title", "query": "yark", "fuzzy": { "maxEdits": 1, "maxExpansions": 100, } } } } ])
1 { 2 "stages" : [ 3 { 4 "$_internalSearchMongotRemote" : { 5 "mongotQuery" : { 6 "text" : { 7 "path" : "title", 8 "query" : "yark", 9 "fuzzy" : { 10 "maxEdits" : 1, 11 "maxExpansions" : 100 12 } 13 } 14 }, 15 "explain" : { 16 "type" : "BooleanQuery", 17 "args" : { 18 "must" : [ ], 19 "mustNot" : [ ], 20 "should" : [ 21 { 22 "type" : "BoostQuery", 23 "args" : { 24 "query" : { 25 "type" : "TermQuery", 26 "args" : { 27 "path" : "title", 28 "value" : "ark" 29 } 30 }, 31 "boost" : 0.6666666269302368 32 } 33 }, 34 { 35 "type" : "BoostQuery", 36 "args" : { 37 "query" : { 38 "type" : "TermQuery", 39 "args" : { 40 "path" : "title", 41 "value" : "yard" 42 } 43 }, 44 "boost" : 0.75 45 } 46 }, 47 { 48 "type" : "BoostQuery", 49 "args" : { 50 "query" : { 51 "type" : "TermQuery", 52 "args" : { 53 "path" : "title", 54 "value" : "mark" 55 } 56 }, 57 "boost" : 0.75 58 } 59 }, 60 { 61 "type" : "BoostQuery", 62 "args" : { 63 "query" : { 64 "type" : "TermQuery", 65 "args" : { 66 "path" : "title", 67 "value" : "park" 68 } 69 }, 70 "boost" : 0.75 71 } 72 }, 73 { 74 "type" : "BoostQuery", 75 "args" : { 76 "query" : { 77 "type" : "TermQuery", 78 "args" : { 79 "path" : "title", 80 "value" : "dark" 81 } 82 }, 83 "boost" : 0.75 84 } 85 }, 86 { 87 "type" : "BoostQuery", 88 "args" : { 89 "query" : { 90 "type" : "TermQuery", 91 "args" : { 92 "path" : "title", 93 "value" : "york" 94 } 95 }, 96 "boost" : 0.75 97 } 98 } 99 ], 100 "filter" : [ ], 101 "minimumShouldMatch" : 0 102 } 103 } 104 } 105 }, 106 { 107 "$_internalSearchIdLookup" : { } 108 } 109 ], 110 "serverInfo" : { 111 "host" : "<hostname>.mongodb.net", 112 "port" : 27017, 113 "version" : "4.4.3", 114 "gitVersion" : "913d6b62acfbb344dde1b116f4161360acd8fd13" 115 }, 116 "ok" : 1, 117 "$clusterTime" : { 118 "clusterTime" : Timestamp(1612457287, 1), 119 "signature" : { 120 "hash" : BinData(0,"kzn7hY7NOduVIqcfx+40ENKbMKQ="), 121 "keyId" : NumberLong("1234567890123456789") 122 } 123 }, 124 "operationTime" : Timestamp(1612457287, 1) 125 }
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" } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$_internalSearchMongotRemote': { 6 mongotQuery: { 7 text: { path: 'title', query: 'prince' }, 8 highlight: { path: 'title', maxNumPassages: 1, maxCharsToExamine: 40 } 9 }, 10 explain: { 11 query: { 12 type: 'TermQuery', 13 args: { path: 'title', value: 'prince' } 14 }, 15 highlight: { resolvedHighlightPaths: [ '$type:string/title' ] }, 16 metadata: { 17 mongotVersion: '1.43.1', 18 mongotHostName: '<hostname>.mogodb.net', 19 indexName: 'default', 20 totalLuceneDocs: 21349 21 } 22 }, 23 requiresSearchMetaCursor: true 24 } 25 }, 26 { '$_internalSearchIdLookup': {} }, 27 { 28 '$project': { 29 description: true, 30 highlights: { '$meta': 'searchHighlights' }, 31 _id: false 32 } 33 } 34 ], 35 queryShapeHash: 'D08444272924C1E04A6E99D0CD4BF82FD929893862B3356F79EC18BBD1F0EF0C', 36 serverInfo: { 37 host: '<hostname>.mogodb.net', 38 port: 27017, 39 version: '8.0.4', 40 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 41 }, 42 serverParameters: { 43 internalQueryFacetBufferSizeBytes: 104857600, 44 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 45 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 46 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 47 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 48 internalQueryProhibitBlockingMergeOnMongoS: 0, 49 internalQueryMaxAddToSetBytes: 104857600, 50 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 51 internalQueryFrameworkControl: 'trySbeRestricted', 52 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 53 }, 54 command: { 55 aggregate: 'movies', 56 pipeline: [ 57 { 58 '$search': { 59 text: { path: 'title', query: 'prince' }, 60 highlight: { path: 'title', maxNumPassages: 1, maxCharsToExamine: 40 } 61 } 62 }, 63 { 64 '$project': { 65 description: 1, 66 _id: 0, 67 highlights: { '$meta': 'searchHighlights' } 68 } 69 } 70 ], 71 cursor: {}, 72 '$db': 'sample_mflix' 73 }, 74 ok: 1, 75 '$clusterTime': { 76 clusterTime: Timestamp({ t: 1738080637, i: 1 }), 77 signature: { 78 hash: Binary.createFromBase64('fIedxkRaoE5IWmIaN7/BsRC0AJc=', 0), 79 keyId: Long('7462787091647168517') 80 } 81 }, 82 operationTime: Timestamp({ t: 1738080637, i: 1 }) 83 }
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] } } } } } ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$searchMeta': { 6 mongotQuery: { 7 facet: { 8 operator: { 9 near: { 10 path: 'released', 11 origin: ISODate('1921-11-01T00:00:00.000Z'), 12 pivot: 7776000000 13 } 14 }, 15 facets: { 16 genresFacet: { type: 'string', path: 'genres' }, 17 yearFacet: { 18 type: 'number', 19 path: 'year', 20 boundaries: [ 1910, 1920, 1930, 1940 ] 21 } 22 } 23 } 24 }, 25 explain: { 26 query: { type: 'LongDistanceFeatureQuery', args: {} }, 27 collectors: { 28 facet: { 29 stringFacetCardinalities: { genresFacet: { queried: 10, total: 25 } } 30 } 31 }, 32 metadata: { 33 mongotVersion: '1.43.1', 34 mongotHostName: '<hostname>.mogodb.net', 35 indexName: 'default', 36 totalLuceneDocs: 21349 37 } 38 }, 39 requiresSearchMetaCursor: true 40 } 41 } 42 ], 43 queryShapeHash: '582DB864C9BCFB96896CF1A3079CF70FAC10A9A1E19E8D66DF20A2BB40424FB5', 44 serverInfo: { 45 host: '<hostname>.mogodb.net', 46 port: 27017, 47 version: '8.0.4', 48 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 49 }, 50 serverParameters: { 51 internalQueryFacetBufferSizeBytes: 104857600, 52 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 53 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 54 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 55 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 56 internalQueryProhibitBlockingMergeOnMongoS: 0, 57 internalQueryMaxAddToSetBytes: 104857600, 58 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 59 internalQueryFrameworkControl: 'trySbeRestricted', 60 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 61 }, 62 command: { 63 aggregate: 'movies', 64 pipeline: [ 65 { 66 '$searchMeta': { 67 facet: { 68 operator: { 69 near: { 70 path: 'released', 71 origin: ISODate('1921-11-01T00:00:00.000Z'), 72 pivot: 7776000000 73 } 74 }, 75 facets: { 76 genresFacet: { type: 'string', path: 'genres' }, 77 yearFacet: { 78 type: 'number', 79 path: 'year', 80 boundaries: [ 1910, 1920, 1930, 1940 ] 81 } 82 } 83 } 84 } 85 } 86 ], 87 cursor: {}, 88 '$db': 'sample_mflix' 89 }, 90 ok: 1, 91 '$clusterTime': { 92 clusterTime: Timestamp({ t: 1738080797, i: 1 }), 93 signature: { 94 hash: Binary.createFromBase64('2E8qAEihttRWdJRyCTXRfA1es7I=', 0), 95 keyId: Long('7462787091647168517') 96 } 97 }, 98 operationTime: Timestamp({ t: 1738080797, i: 1 }) 99 }
파이프라인에서 $limit
단계를 지정하는 쿼리의 경우 explain
결과에는 mongod
이 mongot
에서 요청한 문서 수를 보여주는 mongotDocsRequested
지표가 포함됩니다.
예시
{ "mongotQuery": {}, "explain": {}, "limit": <int>, "sortSpec": {}, "mongotDocsRequested": <int>, }
executionStats
다음 예시에서는 자동 완성 연산자를 사용하여 executionStats
상세 모드로 title
필드를 쿼리합니다.
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 ])
1 { 2 explainVersion: '1', 3 stages: [ 4 { 5 '$_internalSearchMongotRemote': { 6 mongotQuery: { 7 autocomplete: { 8 path: 'title', 9 query: 'pre', 10 fuzzy: { maxEdits: 1, prefixLength: 1, maxExpansions: 256 } 11 } 12 }, 13 explain: { 14 query: { 15 type: 'BooleanQuery', 16 args: { 17 must: [ 18 { 19 type: 'MultiTermQueryConstantScoreBlendedWrapper', 20 args: { 21 queries: [ 22 { 23 type: 'DefaultQuery', 24 args: { queryType: 'AutomatonQuery' }, 25 stats: { 26 context: { millisElapsed: 0 }, 27 match: { millisElapsed: 0 }, 28 score: { millisElapsed: 0 } 29 } 30 } 31 ] 32 }, 33 stats: { 34 context: { 35 millisElapsed: 34.187255, 36 invocationCounts: { 37 createWeight: Long('1'), 38 createScorer: Long('15') 39 } 40 }, 41 match: { 42 millisElapsed: 1.077211, 43 invocationCounts: { nextDoc: Long('812') } 44 }, 45 score: { 46 millisElapsed: 0.274761, 47 invocationCounts: { score: Long('807') } 48 } 49 } 50 } 51 ], 52 mustNot: [], 53 should: [ 54 { 55 type: 'TermQuery', 56 args: { path: 'title', value: 'pre' }, 57 stats: { 58 context: { 59 millisElapsed: 2.495506, 60 invocationCounts: { 61 createWeight: Long('1'), 62 createScorer: Long('5') 63 } 64 }, 65 match: { millisElapsed: 0 }, 66 score: { millisElapsed: 0 } 67 } 68 } 69 ], 70 filter: [], 71 minimumShouldMatch: 0 72 }, 73 stats: { 74 context: { 75 millisElapsed: 43.795864, 76 invocationCounts: { createWeight: Long('1'), createScorer: Long('10') } 77 }, 78 match: { 79 millisElapsed: 1.911068, 80 invocationCounts: { nextDoc: Long('812') } 81 }, 82 score: { 83 millisElapsed: 0.982801, 84 invocationCounts: { score: Long('807') } 85 } 86 } 87 }, 88 collectors: { 89 allCollectorStats: { 90 millisElapsed: 2.51114, 91 invocationCounts: { 92 collect: Long('807'), 93 competitiveIterator: Long('5'), 94 setScorer: Long('5') 95 } 96 }, 97 facet: { collectorStats: { millisElapsed: 0 } } 98 }, 99 resultMaterialization: { 100 stats: { 101 millisElapsed: 10.23124, 102 invocationCounts: { retrieveAndSerialize: Long('1') } 103 } 104 }, 105 metadata: { 106 mongotVersion: '1.43.0', 107 mongotHostName: 'atlas-11decp-shard-00-01.2rnul.mogodb.net', 108 indexName: 'default', 109 totalLuceneDocs: 21349 110 }, 111 resourceUsage: { 112 majorFaults: Long('0'), 113 minorFaults: Long('145'), 114 userTimeMs: Long('30'), 115 systemTimeMs: Long('10'), 116 maxReportingThreads: 1, 117 numBatches: 1 118 } 119 }, 120 requiresSearchMetaCursor: true 121 }, 122 nReturned: Long('0'), 123 executionTimeMillisEstimate: Long('311') 124 }, 125 { 126 '$_internalSearchIdLookup': {}, 127 nReturned: Long('0'), 128 executionTimeMillisEstimate: Long('311') 129 } 130 ], 131 queryShapeHash: '6FD3791F785FA329D4ECD1171E0E5AF6772C18F5F0A7A50FC416D080A93C8CB7', 132 serverInfo: { 133 host: 'atlas-11decp-shard-00-01.2rnul.mogodb.net', 134 port: 27017, 135 version: '8.0.4', 136 gitVersion: 'bc35ab4305d9920d9d0491c1c9ef9b72383d31f9' 137 }, 138 serverParameters: { 139 internalQueryFacetBufferSizeBytes: 104857600, 140 internalQueryFacetMaxOutputDocSizeBytes: 104857600, 141 internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600, 142 internalDocumentSourceGroupMaxMemoryBytes: 104857600, 143 internalQueryMaxBlockingSortMemoryUsageBytes: 104857600, 144 internalQueryProhibitBlockingMergeOnMongoS: 0, 145 internalQueryMaxAddToSetBytes: 104857600, 146 internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600, 147 internalQueryFrameworkControl: 'trySbeRestricted', 148 internalQueryPlannerIgnoreIndexWithCollationForRegex: 1 149 }, 150 command: { 151 aggregate: 'movies', 152 pipeline: [ 153 { 154 '$search': { 155 autocomplete: { 156 path: 'title', 157 query: 'pre', 158 fuzzy: { maxEdits: 1, prefixLength: 1, maxExpansions: 256 } 159 } 160 } 161 } 162 ], 163 cursor: {}, 164 '$db': 'sample_mflix' 165 }, 166 ok: 1, 167 '$clusterTime': { 168 clusterTime: Timestamp({ t: 1737671412, i: 10 }), 169 signature: { 170 hash: Binary.createFromBase64('a3CSqvS0rziAYQCk33WzTo/0Sow=', 0), 171 keyId: Long('7462787091647168517') 172 } 173 }, 174 operationTime: Timestamp({ t: 1737671412, i: 10 }) 175 }
응답 요소에 대해 explain
자세히 학습 결과 설명을 참조하세요.