> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ko/llms.txt # Qdrant 벡터 스토어 QdrantVector 클래스는 다음을 사용하여 벡터 검색을 제공합니다.[Qdrant](https://qdrant.tech/), 벡터 유사성 검색 엔진. 추가 페이로드 및 확장된 필터링 지원을 통해 벡터를 저장, 검색 및 관리할 수 있는 편리한 API를 갖춘 프로덕션 준비 서비스를 제공합니다. ## 생성자 옵션 **url** (`string`): Qdrant 인스턴스의 REST URL입니다. 예: https\://xyz-example.eu-central.aws.cloud.qdrant.io:6333 **apiKey** (`string`): 선택적 Qdrant API 키 **https** (`boolean`): 연결 설정 시 TLS를 사용할지 여부입니다. 사용을 권장합니다. ## 행동 양식 ### `createIndex()` **indexName** (`string`): 생성할 인덱스의 이름 **dimension** (`number`): 벡터 차원(임베딩 Model과 일치해야 함)입니다. 단일 벡터 컬렉션에 필요합니다. **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): 유사도 검색에 사용할 거리 측정 방식 (Default: `cosine`) **namedVectors** (`Record`): 이름이 지정된 벡터 공간의 구성입니다. 제공하면 이름이 지정된 여러 벡터 필드가 있는 컬렉션을 생성합니다. #### 명명된 벡터 컬렉션 만들기 ```typescript // Create a collection with multiple named vector spaces await store.createIndex({ indexName: 'multi_modal', dimension: 768, // fallback namedVectors: { text: { size: 768, distance: 'cosine' }, image: { size: 512, distance: 'euclidean' }, }, }) ``` ### `upsert()` **indexName** (`string`): upsert할 인덱스의 이름 **vectors** (`number[][]`): 임베딩 벡터 배열 **metadata** (`Record[]`): 각 벡터의 메타데이터 **ids** (`string[]`): 선택적 벡터 ID(제공하지 않으면 자동 생성) **vectorName** (`string`): 이름이 지정된 벡터를 사용할 때 upsert할 벡터 공간의 이름입니다. #### 명명된 벡터 공간에 Upserting ```typescript // Upsert into the "text" vector space await store.upsert({ indexName: 'multi_modal', vectors: textEmbeddings, metadata: textMetadata, vectorName: 'text', }) // Upsert into the "image" vector space await store.upsert({ indexName: 'multi_modal', vectors: imageEmbeddings, metadata: imageMetadata, vectorName: 'image', }) ``` ### `query()` **indexName** (`string`): 쿼리할 인덱스의 이름 **queryVector** (`number[]`): 유사한 벡터를 찾기 위한 쿼리 벡터 **topK** (`number`): 반환할 결과 수 (Default: `10`) **filter** (`Record`): 쿼리용 메타데이터 필터 **includeVector** (`boolean`): 결과에 벡터를 포함할지 여부 (Default: `false`) **using** (`string`): 이름이 지정된 벡터를 사용할 때 쿼리할 벡터 필드의 이름입니다. 컬렉션에 이름이 지정된 벡터 필드가 여러 개 있을 때 사용하세요. #### 명명된 벡터 Qdrant는 각 벡터 필드에 이름을 할당하는 [컬렉션당 여러 벡터](https://qdrant.tech/documentation/concepts/vectors/#named-vectors)를 지원합니다. 쿼리할 벡터 필드를 선택하려면 `using` 매개변수를 사용하세요. ```typescript const results = await store.query({ indexName: 'my_index', queryVector: embedding, topK: 10, using: 'title_embedding', // Query against a specific named vector }) ``` ### `listIndexes()` 인덱스 이름의 배열을 문자열로 반환합니다. ### `describeIndex()` **indexName** (`string`): 설명을 조회할 인덱스의 이름 보고: ```typescript interface IndexStats { dimension: number count: number metric: 'cosine' | 'euclidean' | 'dotproduct' } ``` ### `deleteIndex()` **indexName** (`string`): 삭제할 인덱스의 이름 ### `updateVector()` ID 또는 메타데이터 필터를 기준으로 단일 벡터를 업데이트합니다. `id` 또는 `filter` 중 하나만 제공해야 합니다. **indexName** (`string`): 업데이트할 인덱스의 이름 **id** (`string`): 업데이트할 벡터의 ID(filter와 함께 사용할 수 없음) **filter** (`Record`): 업데이트할 벡터를 식별하는 메타데이터 필터(id와 함께 사용할 수 없음) **update** (`{ vector?: number[]; metadata?: Record; }`): 업데이트할 벡터 및/또는 메타데이터가 포함된 객체 지정된 인덱스의 벡터 및/또는 해당 메타데이터를 업데이트합니다. 벡터와 메타데이터가 모두 제공되면 둘 다 업데이트됩니다. 두 값 중 하나를 제공하면 해당 값만 업데이트됩니다. ### `deleteVector()` **indexName** (`string`): 벡터를 삭제할 인덱스의 이름 **id** (`string`): 삭제할 벡터의 ID 해당 ID로 지정된 인덱스에서 벡터를 삭제합니다. ### `deleteVectors()` ID 또는 메타데이터 필터를 기준으로 여러 벡터를 삭제합니다. `ids` 또는 `filter` 중 하나만 제공해야 합니다. **indexName** (`string`): 삭제할 벡터가 포함된 인덱스의 이름 **ids** (`string[]`): 삭제할 벡터 ID 배열(filter와 함께 사용할 수 없음) **filter** (`Record`): 삭제할 벡터를 식별하는 메타데이터 필터(ids와 함께 사용할 수 없음) ### `createPayloadIndex()` 효율적인 필터링을 활성화하도록 컬렉션 필드에 페이로드(메타데이터) 인덱스를 생성합니다. 이는 Qdrant Cloud 및 `strict_mode_config = true`인 모든 Qdrant 인스턴스에 **필수**입니다. **indexName** (`string`): 페이로드 인덱스를 생성할 컬렉션의 이름 **fieldName** (`string`): 인덱싱할 페이로드 필드의 이름 **fieldSchema** (`'keyword' | 'integer' | 'float' | 'geo' | 'text' | 'bool' | 'datetime' | 'uuid'`): 페이로드 필드의 스키마 유형 **wait** (`boolean`): 작업이 완료될 때까지 기다릴지 여부 (Default: `true`) ```typescript // Create a keyword index for filtering by source await store.createPayloadIndex({ indexName: 'my_index', fieldName: 'source', fieldSchema: 'keyword', }) const results = await store.query({ indexName: 'my_index', queryVector: queryVector, filter: { source: 'document-a' }, }) ``` ### `deletePayloadIndex()` 컬렉션 필드에서 페이로드 인덱스를 제거합니다. **indexName** (`string`): 페이로드 인덱스를 삭제할 컬렉션의 이름 **fieldName** (`string`): 삭제할 페이로드 필드 인덱스의 이름 **wait** (`boolean`): 작업이 완료될 때까지 기다릴지 여부 (Default: `true`) ## 응답 유형 쿼리 결과는 다음 형식으로 반환됩니다. ```typescript interface QueryResult { id: string score: number metadata: Record vector?: number[] // Only included if includeVector is true } ``` ## 오류 처리 상점에서는 포착할 수 있는 입력된 오류를 발생시킵니다. ```typescript try { await store.query({ indexName: 'index_name', queryVector: queryVector, }) } catch (error) { if (error instanceof VectorStoreError) { console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc console.log(error.details) // Additional error context } } ``` ## 관련된 - [메타데이터 필터](https://mastra.zisheng.pro/ko/reference/rag/metadata-filters)