> **Experimental**
>
> `@aws-cdk/aws-bedrock-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# KnowledgeBaseOpenSearchServerlessStorage

Stores a knowledge base's vectors in an existing Amazon OpenSearch Serverless vector index.

Sets `StorageConfiguration` to `OPENSEARCH_SERVERLESS` with the given
collection, index and field mapping. Grants the role referenced by the knowledge
base's `roleArn` `aoss:APIAccessAll` on the collection and makes the knowledge
base depend on that policy.

The index must already exist and the collection's data access policy must
allow the service role to describe, read and write it; neither is created here.

Extends: Mixin › KnowledgeBaseOpenSearchServerlessStorage
Implements: IMixin

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`bedrock/mixins/knowledge-base.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-bedrock-alpha/bedrock/mixins/knowledge-base.ts#L64)
- Type last changed: v2.274.0-alpha.0 · 21 Oct 2026

## Example

```ts
declare const collection: opensearchserverless.ICollectionRef;
declare const role: iam.Role;

new aws_bedrock_cfn.CfnKnowledgeBase(this, 'KnowledgeBase', {
  name: 'product-documentation',
  roleArn: role.roleArn,
  knowledgeBaseConfiguration: {
    type: 'VECTOR',
    vectorKnowledgeBaseConfiguration: {
      embeddingModelArn: bedrock.BedrockFoundationModel.TITAN_EMBED_TEXT_V2_1024.modelArn,
    },
  },
}).with(new bedrock.mixins.KnowledgeBaseOpenSearchServerlessStorage({
  collection,
  vectorIndexName: 'bedrock-knowledge-base-default-index',
  vectorField: 'bedrock-knowledge-base-default-vector',
  textField: 'AMAZON_BEDROCK_TEXT_CHUNK',
  metadataField: 'AMAZON_BEDROCK_METADATA',
}));
```

## Initializer

```ts
new KnowledgeBaseOpenSearchServerlessStorage(props: KnowledgeBaseOpenSearchServerlessStorageProps)
```

## Methods

- `applyTo(construct: IConstruct): void` — Applies the mixin functionality to the target construct.

- `isMixin(x: any): boolean` (static) — Checks if `x` is a Mixin.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Mixin`.

- `supports(construct: IConstruct): boolean` — Determines whether this mixin can be applied to the given construct.
