vector 유형을 사용하여 벡터 임베딩을 인덱스할 수 있습니다. 벡터 필드는 다음 유형의 숫자 배열을 포함해야 합니다.
BSON
int32,int64또는double데이터 유형BSON
double데이터 유형
You can use the vectorSearch operator, similar to the $vectorSearch stage, in your $search aggregation pipeline to query fields indexed as the vector type.
vector 유형 제한 사항
다음과 같은 제한 사항이 적용됩니다:
객체 배열(MongoDB Search
embeddedDocuments유형)이 포함된 필드를vector유형으로 인덱스할 수 없습니다.인덱스 정의에
vector유형이 포함된 경우 storedSource를true로 설정할 수 없습니다. 대신include를 사용하여mongot에 저장할 필드를 지정하거나exclude를 사용하여vector유형 필드를 저장에서 제외합니다.You can't use the
$vectorSearchstage to query fields indexed as thevectortype.MongoDB Search Playground에서 필드를
vector유형으로 색인할 수 있습니다.
vector 유형에 대한 인덱스 정의
vector 필드 속성 구성
vector 필드 속성 구성
MongoDB Search vector 유형은 다음 매개 변수를 사용합니다.
옵션 | 유형 | 필요성 | 설명 |
|---|---|---|---|
|
| 필수 사항 | 이 토크나이저 유형을 식별하는 사람이 읽을 수 있는 레이블입니다. 값은 |
| Int | 필수 사항 | MongoDB Search가 인덱스 시점 및 쿼리 시간에 시행하는 벡터 차원의 수입니다. 이 필드는 양자화된 벡터 또는 BinData를 인덱싱 하려면 다음 값 중 하나를 지정할 수 있습니다.
The embedding model you choose determines the number of dimensions in your vector embeddings, with some models having multiple options for how many dimensions are output. To learn more, see Choosing a Method to Create Embeddings. |
| 문자열 | 필수 사항 | 상위 K-최근접 이웃을 검색 데 사용하는 벡터 유사성 함수입니다. 이 필드 다음 값 중 하나를 지정할 수 있습니다.
To learn more, see About the Similarity Functions. |
| 문자열 | 옵션 | 벡터에 대한 자동 벡터 양자화 유형입니다. 임베딩이 다음 값 중 하나를 지정할 수 있습니다.
To learn more, see About Quantization. |
| 문자열 | 옵션 | 벡터 필드 의 인덱스 구조입니다. 값은 다음과 같습니다.
If omitted, defaults to If you specify |
| 객체 | 옵션 | Parameters to use for Hierarchical Navigable Small Worlds graph construction. If omitted, uses the default values for the 중요: 이 기능은 미리 보기 기능으로 제공됩니다. 기본값을 수정하면 MongoDB Search 인덱스와 쿼리에 부정적인 영향을 미칠 수 있습니다. |
| Int | 옵션 | Maximum number of edges (or connections) that a node can have in the Hierarchical Navigable Small Worlds graph. Value can be between A higher number improves :recall (accuracy of search results) because the graph is better connected. However, this also increases query and indexing time by increasing the number of neighbors to evaluate per graph node, and requires more memory to store the additional nodes for each connection in the Hierarchical Navigable Small Worlds graph. |
| Int | 옵션 | 쿼리 시 숫자가 높을수록 고품질 연결을 가진 그래프가 제공되어 검색 품질(재현율)을 향상시킬 수 있지만, 쿼리 지연 시간이 증가할 수도 있습니다. |
vector 유형에 대한 예시 사용해 보기
The following index definition example uses the sample_mflix.embedded_movies collection in the sample data. After you load the collection, you can use the following example to index the plot_embedding_voyage_3_large field as the vector type for running queries using the vectorSearch (MongoDB Search Operator). For a sample query to run against this index, see Examples.
이 인덱스 정의는 동적으로 인덱싱 가능한 모든 필드를 기본값 typeSet를 사용하여 자동으로 인덱싱하고, plot_embedding_voyage_3_large 필드를 vector 유형으로 다음 설정을 사용하여 인덱싱합니다.
2048차원의 수dotProduct유사성 함수scalar양자화hnsw(기본값) 인덱싱 메서드