CreateIndex
Source:
src/AWS/OpenSearchServerless/CreateIndex.ts
Runtime binding for the CreateIndex operation scoped to one collection
(IAM action aoss:APIAccessAll on the collection ARN).
Creates an index in the bound Collection from inside a function
runtime — the control-plane path for the multi-tenant pattern where each
tenant gets its own (vector) index. The calling principal must also be
granted aoss:CreateIndex on the index pattern by a data
AccessPolicy. Provide the implementation with
Effect.provide(AWS.OpenSearchServerless.CreateIndexHttp).
Managing Indexes at Runtime
Section titled “Managing Indexes at Runtime”// init — bind the operation to the collectionconst createIndex = yield* AWS.OpenSearchServerless.CreateIndex(collection);
// runtimeyield* createIndex({ indexName: `tenant-${tenantId}`, indexSchema: { mappings: { properties: { embedding: { type: "knn_vector", dimension: 1536 }, }, }, },});