Docs Menu
Docs Home
/
MongoDB Atlas
/ /

Atlas Vector Search 결과 설명

이 페이지의 내용

  • 구문
  • 상세
  • 결과 설명
  • collectors
  • allCollectorStats
  • metadata
  • query
  • args
  • stats
  • resourceUsage
  • 예시
  • allPlansExecution
  • queryPlanner
  • executionStats

메서드를 사용하여 Atlas Vector Search 쿼리 explain 실행 쿼리 쿼리 내부적으로 실행 된 방식을 설명하는 실행 쿼리 계획 계획이 포함된 BSON 문서반환합니다.

다음도 참조하세요.

explain 명령

db.<myCollection>.explain("<verbosity>").aggregate([
{
"$vectorSearch": {
"exact": true | false,
"filter": {<filter-specification>},
"index": "<index-name>",
"limit": <number-of-results>,
"numCandidates": <number-of-candidates>,
"path": "<field-to-search>",
"queryVector": [<array-of-numbers>]
}
}
])

상세 모드 explain 의 동작과 반환되는 정보의 양을 제어합니다. 값은 상세도가 낮은 순서대로 다음 중 하나일 수 있습니다.

쿼리에 대한 실행 쿼리 가 포함된 stats 필드를 포함한 쿼리 계획 에 대한 정보입니다. 계획 선택 중에 캡처한 부분 실행 데이터를 포함합니다.

쿼리에 대한 실행 통계가 포함된 stats 필드를 포함한 쿼리 계획에 대한 정보입니다.

queryPlanner(기본값)

쿼리 계획에 대한 정보입니다. 쿼리에 대한 실행 통계를 포함하는 stats 필드는 포함되지 않습니다.

다음도 참조하세요.

explain 메서드는 다음 필드가 있는 BSON 문서 반환합니다.

옵션
유형
필요성
목적

collectors

문서

옵션

수집기에 대한 실행 통계를 설명합니다.

metadata

문서

옵션

유용한 메타데이터를 포함합니다.

query

문서

옵션

쿼리 에 대한 실행 통계를 설명합니다. 이는 indexPartitionExplain의 최상위 수준에는 존재하지 않습니다.

resultMaterialization

문서

옵션

쿼리 실행 후 문서별 데이터 검색과 관련된 세부 정보입니다. queryPlanner 상세도 모드 에서는 이 값이 반환되지 않습니다.

resourceUsage

문서

옵션

쿼리가 실행되었을 때 쿼리의 리소스 사용량 세부 정보를 제공합니다. queryPlanner 상세 수준 모드에서는 반환되지 않습니다.

collectors 은 다음 필드 있는 BSON 문서 입니다.

필드
유형
필요성
목적

allCollectorStats

문서

필수 사항

쿼리 의 모든 수집기 통계입니다. 보고된 통계는 쿼리 에 사용된 모든 수집기의 최대값 또는 모든 하위 수집기의 통계 합계를 나타냅니다. 타이밍 통계는 전체 쿼리 에 대해 모든 수집기에서 소요된 총 시간을 반영하기 위해 합산됩니다. 자세한 학습 은 allCollectorStats를 참조하세요.

allCollectorStats 은 쿼리 에 지정된 모든 수집기의 수집기 통계를 설명하는 BSON 문서 입니다. 여기에는 다음과 같은 키가 포함되어 있습니다.

필드
설명

collect

수집기가 수집한 결과의 지속 시간과 수량을 추적합니다.

competitiveIterator

수집기에서 competitiveIterator가 요청된 총 지속 시간과 횟수를 추적하는 통계입니다.

setScorer

수집기에 설정된 점수 계산기의 총 지속 시간과 횟수를 추적하는 통계입니다.

metadata는 다음과 같은 유용한 메타데이터를 포함합니다.

필드
유형
필요성
목적

mongotVersion

문자열

옵션

mongot의 현재 버전입니다.

mongotHostName

문자열

옵션

mongot 호스트를 식별하는 사람이 읽을 수 있는 레이블입니다.

indexName

문자열

옵션

쿼리 에 사용된 Atlas Vector Search 인덱스 .

cursorOptions

문서

옵션

mongot에 커서 옵션이 제공됩니다.

totalLuceneDocs

Integer

옵션

삭제된 문서를 포함하여 인덱스 에 있는 총 문서 수입니다.

explain 응답은 쿼리의 실행 통계를 설명하는 키와 값이 포함된 BSON 문서입니다. 결과 세트의 explain 문서에는 다음 필드가 포함되어 있습니다.

필드
유형
필요성
목적

path

문자열

옵션

루트가 아닌 경우에만 쿼리된 임베딩 필드 의 경로입니다.

type

문자열

필수 사항

벡터 검색 쿼리 유형의 이름입니다. 자세한 내용은 query 를 참조하세요.

args

문서

필수 사항

벡터 검색 쿼리 정보입니다. 자세한 내용은 query 를 참조하세요.

stats

문서

옵션

explainexecutionStats 또는 allPlansExecution 상세 수준으로 실행된 경우 쿼리에 대한 stats입니다.

설명 응답 에는 쿼리 내부적으로 실행된 방식에 대한 정보가 포함되어 있습니다. args 필드 에는 다음과 같은 세부 정보가 포함되어 있습니다.

  • 쿼리 유형

  • 각 쿼리 유형에 대한 구조화된 요약 예시

  • 구조화된 요약의 쿼리 옵션

다음 섹션에서는 구조화된 요약의 쿼리 유형과 필드에 대해 설명합니다.

WrappedKnnQuery

여러 쿼리를 결합하는 ANN 벡터 검색에 사용되는 래퍼 쿼리입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.

필드
유형
필요성
설명

query

배열

필수 사항

벡터 검색 에 사용되는 하위 쿼리의 배열로, 일반적으로 KnnFloatVectorQueryDocAndScoreQuery를 포함합니다.

KnnFloatVectorQuery

부동 소수점 벡터에 대한 ANN 검색과 관련된 쿼리 유형입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.

필드
유형
필요성
설명

field

문자열

필수 사항

검색 중인 벡터 필드 경로 .

k

Integer

필수 사항

조회 할 가장 가까운 이웃의 수입니다.

DocAndScoreQuery

문서 일치 및 점수 산정을 처리하는 쿼리 유형입니다. 구조화된 요약에는 일반적으로 쿼리 실행에 대한 통계가 포함됩니다.

ExactVectorSearchQuery

ENN 벡터 검색을 위한 쿼리 유형입니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.

필드
유형
필요성
설명

field

문자열

필수 사항

검색 중인 벡터 필드 경로 .

similarityFunction

문자열

필수 사항

사용된 유사성 함수(dotProduct, cosine 또는 euclidean)입니다.

filter

문서

옵션

벡터 검색 범위를 제한하는 사전 필터 쿼리 .

BooleanQuery

벡터 검색 쿼리 에서 사전 필터를 사용하는 경우 설명 결과에 BooleanQuery 유형이 포함됩니다. 이 유형의 필드 및 사전 필터 쿼리 와 관련된 기타 쿼리 유형에 대해 자세히 학습 Atlas Search 설명 페이지의 쿼리 유형을 참조하세요.

DefaultQuery

다른 쿼리 에서 명시적으로 정의되지 않은 쿼리는 기본값 쿼리 사용하여 직렬화됩니다. 구조화된 요약에는 다음 옵션에 대한 세부 정보가 포함되어 있습니다.

필드
유형
필요성
설명

queryType

문자열

필수 사항

쿼리 유형입니다.

executionStatsallPlansExecution 상세도 모드에 대한 explain 응답에는 stats 쿼리가 쿼리 실행의 다양한 단계 에서 소비하는 시간 에 대한 정보가 포함된 필드가 포함되어 있습니다.

타이밍 분석은 쿼리 실행 영역 과 관련된 실행 통계를 설명합니다. 다음 필드에는 타이밍 분석이 표시됩니다.

필드
유형
설명

millisElapsed

Long

쿼리 의 하위 항목이 이 영역에서 보낸 시간을 포함하여 이 영역에서 작업을 수행하는 데 경과된 대략적인 벽시계 시간입니다. 값은 이 영역에서 작업을 수행하는 동안 경과된 대략적인 시간(밀리초)입니다.

invocationCounts

문서

이 영역에 포함된 작업 호출의 횟수입니다. 값은 작업 이름과 해당 호출 횟수의 맵입니다.

다음 쿼리 영역에 대한 통계를 사용할 수 있습니다.

옵션
설명

context

벡터 검색 쿼리 실행과 관련된 통계입니다. 이 영역에 호출 횟수가 열거되는 두 가지 작업이 있습니다.

createScorer

점수 산정기는 문서를 반복하고 각 문서에 대한 점수를 생성합니다. createScorer 호출은 점수 산정을 담당하는 객체를 생성합니다. 이 작업과 관련된 시간은 실제로 문서에 점수를 매기는 데 소요된 시간이 아닙니다. 개수에는 scorerSupplier 호출 수가 포함됩니다.

createWeight

가중치는 쿼리 및 IndexSearcher 과 관련된 상태를 저장합니다. 개수에는 createWeight 호출 수가 포함됩니다.

이 영역에서 소요된 시간은 쿼리 구조와 관련이 있으며, 반복되고 점수가 매겨지는 결과 수에 기반하지 않습니다.

예를 들면 다음과 같습니다.

"context" : {
"millisElapsed" : NumberDouble(4.934751),
"invocationCounts" : {
"createWeight" : NumberLong(1),
"createScorer" : NumberLong(10)
}
}

match

결과 문서를 반복하고 일치시키는 것과 관련된 통계입니다. 이 통계는 어떤 문서가 다음 일치 항목인지 결정하는 데 걸리는 시간을 보여줍니다. 결과 일치에 소요되는 시간은 쿼리의 특성에 따라 크게 달라질 수 있습니다. 이 영역에서 호출 횟수가 열거되는 두 가지 작업이 있습니다.

nextDoc

결과 집합의 다음 문서로 이동하도록 요청합니다. 여기에는 과거의 건너뛰기 또는 다음 일치 항목을 찾는 데 필요한 기타 작업을 식별하고 이동하는 등이 포함됩니다. 개수에는 nextDocadvance 호출 수가 포함됩니다.

refineRoughMatch

보다 철저한 일치를 수행합니다. 일부 쿼리는 문서가 먼저 '대략' 일치하는 2단계 프로세스로 실행되고, 첫 번째 대략적인 일치를 충족한 후에만 두 번째, 보다 철저한 단계에서 확인됩니다. refineRoughMatch 작업은 2단계 프로세스 중 두 번째 단계입니다. 개수에는 refineRoughMatch 호출 수가 포함됩니다.

예를 들면 다음과 같습니다.

"match" : {
"millisElapsed" : NumberDouble(4.901597),
"invocationCounts" : {
"nextDoc" : NumberLong(541),
"refineRoughMatch" : NumberLong(0)
}
}

score

결과 세트의 문서 점수 산정과 관련된 통계입니다. 이 영역에서 호출 횟수가 열거되는 두 가지 작업이 있습니다.

score

결과 세트의 각 문서에 점수를 매깁니다. 개수에는 score 호출 수가 포함됩니다.

setMinCompetitiveScore

점수가 지정된 값보다 낮은 문서를 무시합니다. 점수가 경쟁적이지 않은 일부 임계값보다 낮은 문서를 무시하여 쿼리가 수행되는 점수 산정 작업 수를 줄일 수 있었음을 나타냅니다. 개수에는 setMinCompetitiveScore 호출 수가 포함됩니다.

예를 들면 다음과 같습니다.

"score" : {
"millisElapsed" : NumberDouble(3.931312),
"invocationCounts" : {
"score" : NumberLong(536),
"setMinCompetitiveScore" : NumberLong(0)
}
}

resourceUsage 문서는 쿼리 실행에 사용된 리소스를 보여줍니다. 다음 필드를 포함합니다.

필드
유형
필요성
목적

majorFaults

Long

필수 사항

쿼리 실행 중 시스템이 메모리에서 필요한 데이터를 찾지 못해 디스크와 같은 백업 저장소에서 읽게 될 때 발생하는 주요 페이지 폴트 수입니다.

minorFaults

Long

필수 사항

데이터가 페이지 캐시에 있지만 아직 프로세스의 페이지 테이블에 매핑되지 않은 경우 발생하는 경미한 페이지 폴트의 수입니다.

userTimeMs

Long

필수 사항

사용자 공간에서 소요된 CPU 시간(밀리초)입니다.

systemTimeMs

Long

필수 사항

시스템 공간에서 소요된 CPU 시간(단위: 밀리초)입니다.

maxReportingThreads

Integer

필수 사항

모든 배치에서 쿼리 실행 중 mongot가 사용한 최대 스레드 수입니다. 동시 실행되지 않는 설명 쿼리의 경우 값은 1입니다.

numBatches

Integer

필수 사항

쿼리 처리 시 요청된 mongot의 총 배치 수입니다.

다음 예제에서는 샘플 ANNENN 쿼리에 explain 메서드를 사용합니다. 자신의 환경에서 다음 예제를 실행 하려면 먼저 을(를) 사용하여 Atlas Vector Search 빠른 시작을 완료해야 mongosh 합니다.

다음 예시 상세도 모드 사용하여 필드 plot_embedding 에 대한 ANN 및 ENN 벡터 검색 쿼리 allPlansExecution 에서 explain 메서드를 실행합니다.

db.embedded_movies.explain("allPlansExecution").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"numCandidates": 150,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10,
explain: {
query: {
type: 'WrappedKnnQuery',
args: {
query: [
{
type: 'KnnFloatVectorQuery',
args: { field: '$type:knnVector/plot_embedding', k: 150 },
stats: {
context: { millisElapsed: 0 },
match: { millisElapsed: 0 },
score: { millisElapsed: 0 }
}
},
{
type: 'DocAndScoreQuery',
args: {},
stats: {
context: {
millisElapsed: 0.011281,
invocationCounts: {
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 0.045831,
invocationCounts: { nextDoc: Long('151') }
},
score: {
millisElapsed: 0.049853,
invocationCounts: {
score: Long('150'),
setMinCompetitiveScore: Long('30')
}
}
}
}
]
},
stats: {
context: {
millisElapsed: 3.226133,
invocationCounts: {
vectorExecution: Long('1'),
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 0.045831,
invocationCounts: { nextDoc: Long('151') }
},
score: {
millisElapsed: 0.049853,
invocationCounts: {
score: Long('150'),
setMinCompetitiveScore: Long('30')
}
}
}
},
collectors: {
allCollectorStats: {
millisElapsed: 0.211472,
invocationCounts: {
collect: Long('150'),
competitiveIterator: Long('1'),
setScorer: Long('1')
}
},
facet: { collectorStats: { millisElapsed: 0 } }
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
},
resourceUsage: {
majorFaults: Long('0'),
minorFaults: Long('0'),
userTimeMs: Long('0'),
systemTimeMs: Long('0'),
maxReportingThreads: 1,
numBatches: 1
}
}
},
nReturned: Long('0'),
executionTimeMillisEstimate: Long('29')
},
{
'$_internalSearchIdLookup': { limit: Long('10') },
nReturned: Long('0'),
executionTimeMillisEstimate: Long('29')
}
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740781674, i: 1 }),
signature: {
hash: Binary.createFromBase64('gpGnPOB17p3NnKu74vhm+kCLXf8=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740781674, i: 1 })
}
db.embedded_movies.explain("allPlansExecution").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"exact": true,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10,
explain: {
query: {
type: 'ExactVectorSearchQuery',
args: {
field: '$type:knnVector/plot_embedding',
similarityFunction: 'dotProduct',
filter: {
type: 'DefaultQuery',
args: { queryType: 'FieldExistsQuery' },
stats: {
context: {
millisElapsed: 0.031999,
invocationCounts: {
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 1.2138,
invocationCounts: { nextDoc: Long('3403') }
},
score: { millisElapsed: 0 }
}
}
},
stats: {
context: {
millisElapsed: 0.055318,
invocationCounts: { createWeight: Long('1'), createScorer: Long('2') }
},
match: {
millisElapsed: 2.578062,
invocationCounts: { nextDoc: Long('3403') }
},
score: {
millisElapsed: 5.624325,
invocationCounts: {
score: Long('3402'),
setMinCompetitiveScore: Long('71')
}
}
}
},
collectors: {
allCollectorStats: {
millisElapsed: 7.095773,
invocationCounts: {
collect: Long('3402'),
competitiveIterator: Long('1'),
setScorer: Long('1')
}
},
facet: { collectorStats: { millisElapsed: 0 } }
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
},
resourceUsage: {
majorFaults: Long('0'),
minorFaults: Long('0'),
userTimeMs: Long('0'),
systemTimeMs: Long('0'),
maxReportingThreads: 1,
numBatches: 1
}
}
},
nReturned: Long('0'),
executionTimeMillisEstimate: Long('19')
},
{
'$_internalSearchIdLookup': { limit: Long('10') },
nReturned: Long('0'),
executionTimeMillisEstimate: Long('19')
}
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740781894, i: 1 }),
signature: {
hash: Binary.createFromBase64('cNmipB7AsFGaT4ipmWCKizM/EbU=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740781894, i: 1 })
}

다음 예시 상세도 모드 사용하여 필드 plot_embedding 에 대한 ANN 및 ENN 벡터 검색 쿼리 queryPlanner 에서 explain 메서드를 실행합니다.

db.embedded_movies.explain("queryPlanner").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"numCandidates": 150,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10,
explain: {
query: {
type: 'WrappedKnnQuery',
args: {
query: [
{
type: 'KnnFloatVectorQuery',
args: { field: '$type:knnVector/plot_embedding', k: 150 }
},
{ type: 'DocAndScoreQuery', args: {} }
]
}
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
}
}
}
},
{ '$_internalSearchIdLookup': { limit: Long('10') } }
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740782044, i: 1 }),
signature: {
hash: Binary.createFromBase64('/ZHh6h+2qbJtYdOBHmeZepo1Wsc=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740782044, i: 1 })
}
db.embedded_movies.explain("queryPlanner").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"exact": true,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10,
explain: {
query: {
type: 'ExactVectorSearchQuery',
args: {
field: '$type:knnVector/plot_embedding',
similarityFunction: 'dotProduct',
filter: {
type: 'DefaultQuery',
args: { queryType: 'FieldExistsQuery' }
}
}
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
}
}
}
},
{ '$_internalSearchIdLookup': { limit: Long('10') } }
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740782103, i: 23 }),
signature: {
hash: Binary.createFromBase64('yn3TtM4cfhu6HXCGzBGPbLmlM4E=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740782103, i: 23 })
}

다음 예시 상세도 모드 사용하여 필드 plot_embedding 에 대한 ANN 및 ENN 벡터 검색 쿼리 executionStats 에서 explain 메서드를 실행합니다.

db.embedded_movies.explain("executionStats").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"numCandidates": 150,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10,
explain: {
query: {
type: 'WrappedKnnQuery',
args: {
query: [
{
type: 'KnnFloatVectorQuery',
args: { field: '$type:knnVector/plot_embedding', k: 150 },
stats: {
context: { millisElapsed: 0 },
match: { millisElapsed: 0 },
score: { millisElapsed: 0 }
}
},
{
type: 'DocAndScoreQuery',
args: {},
stats: {
context: {
millisElapsed: 0.015853,
invocationCounts: {
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 0.013112,
invocationCounts: { nextDoc: Long('151') }
},
score: {
millisElapsed: 0.033269,
invocationCounts: {
score: Long('150'),
setMinCompetitiveScore: Long('30')
}
}
}
}
]
},
stats: {
context: {
millisElapsed: 3.979414,
invocationCounts: {
vectorExecution: Long('1'),
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 0.013112,
invocationCounts: { nextDoc: Long('151') }
},
score: {
millisElapsed: 0.033269,
invocationCounts: {
score: Long('150'),
setMinCompetitiveScore: Long('30')
}
}
}
},
collectors: {
allCollectorStats: {
millisElapsed: 0.115101,
invocationCounts: {
collect: Long('150'),
competitiveIterator: Long('1'),
setScorer: Long('1')
}
},
facet: { collectorStats: { millisElapsed: 0 } }
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
},
resourceUsage: {
majorFaults: Long('0'),
minorFaults: Long('0'),
userTimeMs: Long('0'),
systemTimeMs: Long('0'),
maxReportingThreads: 1,
numBatches: 1
}
}
},
nReturned: Long('0'),
executionTimeMillisEstimate: Long('13')
},
{
'$_internalSearchIdLookup': { limit: Long('10') },
nReturned: Long('0'),
executionTimeMillisEstimate: Long('13')
}
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
numCandidates: 150,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740782136, i: 1 }),
signature: {
hash: Binary.createFromBase64('33LuqO946oIzmslClhuu+Z+PthQ=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740782136, i: 1 })
}
db.embedded_movies.explain("executionStats").aggregate([
{
"$vectorSearch": {
"index": "vector_index",
"path": "plot_embedding",
"queryVector": QUERY_EMBEDDING,
"exact": true,
"limit": 10
}
}
])
{
explainVersion: '1',
stages: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10,
explain: {
query: {
type: 'ExactVectorSearchQuery',
args: {
field: '$type:knnVector/plot_embedding',
similarityFunction: 'dotProduct',
filter: {
type: 'DefaultQuery',
args: { queryType: 'FieldExistsQuery' },
stats: {
context: {
millisElapsed: 0.029472,
invocationCounts: {
createWeight: Long('1'),
createScorer: Long('2')
}
},
match: {
millisElapsed: 0.234054,
invocationCounts: { nextDoc: Long('3403') }
},
score: { millisElapsed: 0 }
}
}
},
stats: {
context: {
millisElapsed: 0.050328,
invocationCounts: { createWeight: Long('1'), createScorer: Long('2') }
},
match: {
millisElapsed: 0.622028,
invocationCounts: { nextDoc: Long('3403') }
},
score: {
millisElapsed: 3.03997,
invocationCounts: {
score: Long('3402'),
setMinCompetitiveScore: Long('71')
}
}
}
},
collectors: {
allCollectorStats: {
millisElapsed: 3.601357,
invocationCounts: {
collect: Long('3402'),
competitiveIterator: Long('1'),
setScorer: Long('1')
}
},
facet: { collectorStats: { millisElapsed: 0 } }
},
metadata: {
mongotVersion: '1.44.0',
mongotHostName: '<hostname>.mongodb.net',
indexName: 'vector_index',
totalLuceneDocs: 3483
},
resourceUsage: {
majorFaults: Long('0'),
minorFaults: Long('0'),
userTimeMs: Long('0'),
systemTimeMs: Long('0'),
maxReportingThreads: 1,
numBatches: 1
}
}
},
nReturned: Long('0'),
executionTimeMillisEstimate: Long('12')
},
{
'$_internalSearchIdLookup': { limit: Long('10') },
nReturned: Long('0'),
executionTimeMillisEstimate: Long('12')
}
],
queryShapeHash: '9EFFBE6AC5B8DC66D20DB8939CF3ED6669D0C09BB6938C17AD3FB8C7793765B8',
serverInfo: {
host: '<hostname>.mongodb.net',
port: 27017,
version: '8.0.5',
gitVersion: 'cb9e2e5e552ee39dea1e39d7859336456d0c9820'
},
serverParameters: {
internalQueryFacetBufferSizeBytes: 104857600,
internalQueryFacetMaxOutputDocSizeBytes: 104857600,
internalLookupStageIntermediateDocumentMaxSizeBytes: 104857600,
internalDocumentSourceGroupMaxMemoryBytes: 104857600,
internalQueryMaxBlockingSortMemoryUsageBytes: 104857600,
internalQueryProhibitBlockingMergeOnMongoS: 0,
internalQueryMaxAddToSetBytes: 104857600,
internalDocumentSourceSetWindowFieldsMaxMemoryBytes: 104857600,
internalQueryFrameworkControl: 'trySbeRestricted',
internalQueryPlannerIgnoreIndexWithCollationForRegex: 1
},
command: {
aggregate: 'embedded_movies',
pipeline: [
{
'$vectorSearch': {
index: 'vector_index',
path: 'plot_embedding',
queryVector: [
-0.0016261312, -0.028070757, -0.011342932, -0.012775794,
...
-0.0060913274, -0.007130985, -0.013109017, -0.009710136
],
exact: true,
limit: 10
}
}
],
cursor: {},
'$db': 'sample_mflix'
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1740782184, i: 1 }),
signature: {
hash: Binary.createFromBase64('tpxoW70Y+Z5HmDqaswag+matLQQ=', 0),
keyId: Long('7446434162581438465')
}
},
operationTime: Timestamp({ t: 1740782184, i: 1 })
}

돌아가기

쿼리 생성 및 실행