AWS.Kendra reference
BatchDeleteDocument
Section titled “BatchDeleteDocument”Source:
src/AWS/Kendra/BatchDeleteDocument.ts
Runtime binding for the BatchDeleteDocument operation (IAM action
kendra:BatchDeleteDocument), scoped to one Index.
Removes documents from the index by id. Check the response’s
FailedDocuments for per-document errors.
Provide the implementation with
Effect.provide(AWS.Kendra.BatchDeleteDocumentHttp).
BatchDeleteDocument: Indexing Documents
Section titled “BatchDeleteDocument: Indexing Documents”const deleteDocuments = yield* AWS.Kendra.BatchDeleteDocument(index);
yield* deleteDocuments({ DocumentIdList: ["welcome"] });BatchGetDocumentStatus
Section titled “BatchGetDocumentStatus”Source:
src/AWS/Kendra/BatchGetDocumentStatus.ts
Runtime binding for the BatchGetDocumentStatus operation (IAM action
kendra:BatchGetDocumentStatus), scoped to one Index.
Returns the indexing status (INDEXED, PROCESSING, FAILED, …) of
documents added with BatchPutDocument or a data-source sync.
Provide the implementation with
Effect.provide(AWS.Kendra.BatchGetDocumentStatusHttp).
BatchGetDocumentStatus: Indexing Documents
Section titled “BatchGetDocumentStatus: Indexing Documents”const documentStatus = yield* AWS.Kendra.BatchGetDocumentStatus(index);
const status = yield* documentStatus({ DocumentInfoList: [{ DocumentId: "welcome" }],});console.log(status.DocumentStatusList?.[0]?.DocumentStatus);BatchPutDocument
Section titled “BatchPutDocument”Source:
src/AWS/Kendra/BatchPutDocument.ts
Runtime binding for the BatchPutDocument operation (IAM action
kendra:BatchPutDocument), scoped to one Index.
Adds documents directly to the index (inline blobs or S3 paths) —
the push-API alternative to a data-source sync. Check the response’s
FailedDocuments for per-document errors; documents index
asynchronously (poll with BatchGetDocumentStatus).
Provide the implementation with
Effect.provide(AWS.Kendra.BatchPutDocumentHttp).
BatchPutDocument: Indexing Documents
Section titled “BatchPutDocument: Indexing Documents”const putDocuments = yield* AWS.Kendra.BatchPutDocument(index);
const result = yield* putDocuments({ Documents: [ { Id: "welcome", Title: "Welcome", Blob: new TextEncoder().encode("Hello from Alchemy"), ContentType: "PLAIN_TEXT", }, ],});// result.FailedDocuments is empty on successClearQuerySuggestions
Section titled “ClearQuerySuggestions”Source:
src/AWS/Kendra/ClearQuerySuggestions.ts
Runtime binding for the ClearQuerySuggestions operation (IAM action
kendra:ClearQuerySuggestions), scoped to one Index.
Clears existing query suggestions for the index. Suggestions rebuild
from new query traffic (which can take up to 24 hours).
Provide the implementation with
Effect.provide(AWS.Kendra.ClearQuerySuggestionsHttp).
ClearQuerySuggestions: Query Suggestions
Section titled “ClearQuerySuggestions: Query Suggestions”const clearSuggestions = yield* AWS.Kendra.ClearQuerySuggestions(index);
yield* clearSuggestions();CreateAccessControlConfiguration
Section titled “CreateAccessControlConfiguration”Source:
src/AWS/Kendra/CreateAccessControlConfiguration.ts
Runtime binding for the CreateAccessControlConfiguration operation (IAM action
kendra:CreateAccessControlConfiguration), scoped to one Index.
Creates a named access-control configuration (user/group ACLs) on the
index. Kendra designed this for runtime use: re-apply access changes
to documents at query time without re-indexing them — e.g. revoke a
departed user’s access, then reference the returned Id from a
document’s AccessControlConfigurationId.
Provide the implementation with
Effect.provide(AWS.Kendra.CreateAccessControlConfigurationHttp).
CreateAccessControlConfiguration: Access Control Configurations
Section titled “CreateAccessControlConfiguration: Access Control Configurations”const createAcl = yield* AWS.Kendra.CreateAccessControlConfiguration(index);
const { Id } = yield* createAcl({ Name: "block-departed-users", AccessControlList: [ { Name: "departed-user", Type: "USER", Access: "DENY" }, ],});DataSource
Section titled “DataSource”Source:
src/AWS/Kendra/DataSource.ts
An Amazon Kendra data source — a connector that syncs documents from a repository (S3 bucket, SharePoint, website, …) into a Kendra index.
DataSource: Creating Data Sources
Section titled “DataSource: Creating Data Sources”S3 Data Source
import * as AWS from "alchemy/AWS";
const source = yield* AWS.Kendra.DataSource("Docs", { indexId: index.id, type: "S3", roleArn: dataSourceRole.roleArn, configuration: { S3Configuration: { BucketName: bucket.bucketName, }, },});Scheduled Sync
const source = yield* AWS.Kendra.DataSource("Docs", { indexId: index.id, type: "S3", roleArn: dataSourceRole.roleArn, schedule: "cron(0 12 * * ? *)", configuration: { S3Configuration: { BucketName: bucket.bucketName }, },});DeleteAccessControlConfiguration
Section titled “DeleteAccessControlConfiguration”Source:
src/AWS/Kendra/DeleteAccessControlConfiguration.ts
Runtime binding for the DeleteAccessControlConfiguration operation (IAM action
kendra:DeleteAccessControlConfiguration), scoped to one Index.
Deletes an access-control configuration from the index.
Provide the implementation with
Effect.provide(AWS.Kendra.DeleteAccessControlConfigurationHttp).
DeleteAccessControlConfiguration: Access Control Configurations
Section titled “DeleteAccessControlConfiguration: Access Control Configurations”const deleteAcl = yield* AWS.Kendra.DeleteAccessControlConfiguration(index);
yield* deleteAcl({ Id: configurationId });DeletePrincipalMapping
Section titled “DeletePrincipalMapping”Source:
src/AWS/Kendra/DeletePrincipalMapping.ts
Runtime binding for the DeletePrincipalMapping operation (IAM action
kendra:DeletePrincipalMapping), scoped to one Index.
Deletes a group’s user-to-group mapping created with
PutPrincipalMapping.
Provide the implementation with
Effect.provide(AWS.Kendra.DeletePrincipalMappingHttp).
DeletePrincipalMapping: Principal Mapping
Section titled “DeletePrincipalMapping: Principal Mapping”const deleteMapping = yield* AWS.Kendra.DeletePrincipalMapping(index);
yield* deleteMapping({ GroupId: "engineering" });DescribeAccessControlConfiguration
Section titled “DescribeAccessControlConfiguration”Source:
src/AWS/Kendra/DescribeAccessControlConfiguration.ts
Runtime binding for the DescribeAccessControlConfiguration operation (IAM action
kendra:DescribeAccessControlConfiguration), scoped to one Index.
Reads one access-control configuration of the index.
Provide the implementation with
Effect.provide(AWS.Kendra.DescribeAccessControlConfigurationHttp).
DescribeAccessControlConfiguration: Access Control Configurations
Section titled “DescribeAccessControlConfiguration: Access Control Configurations”const describeAcl = yield* AWS.Kendra.DescribeAccessControlConfiguration(index);
const acl = yield* describeAcl({ Id: configurationId });console.log(acl.Name, acl.AccessControlList);DescribePrincipalMapping
Section titled “DescribePrincipalMapping”Source:
src/AWS/Kendra/DescribePrincipalMapping.ts
Runtime binding for the DescribePrincipalMapping operation (IAM action
kendra:DescribePrincipalMapping), scoped to one Index.
Describes the processing state of the PUT/DELETE actions applied
to a group’s principal mapping.
Provide the implementation with
Effect.provide(AWS.Kendra.DescribePrincipalMappingHttp).
DescribePrincipalMapping: Principal Mapping
Section titled “DescribePrincipalMapping: Principal Mapping”const describeMapping = yield* AWS.Kendra.DescribePrincipalMapping(index);
const mapping = yield* describeMapping({ GroupId: "engineering" });console.log(mapping.GroupOrderingIdSummaries);DescribeQuerySuggestionsConfig
Section titled “DescribeQuerySuggestionsConfig”Source:
src/AWS/Kendra/DescribeQuerySuggestionsConfig.ts
Runtime binding for the DescribeQuerySuggestionsConfig operation (IAM action
kendra:DescribeQuerySuggestionsConfig), scoped to one Index.
Reads the index’s query-suggestions settings (mode, query-log look-back
window, attribute-suggestions config, …).
Provide the implementation with
Effect.provide(AWS.Kendra.DescribeQuerySuggestionsConfigHttp).
DescribeQuerySuggestionsConfig: Query Suggestions
Section titled “DescribeQuerySuggestionsConfig: Query Suggestions”const suggestionsConfig = yield* AWS.Kendra.DescribeQuerySuggestionsConfig(index);
const config = yield* suggestionsConfig();console.log(config.Mode, config.Status);GetQuerySuggestions
Section titled “GetQuerySuggestions”Source:
src/AWS/Kendra/GetQuerySuggestions.ts
Runtime binding for the GetQuerySuggestions operation (IAM action
kendra:GetQuerySuggestions), scoped to one Index.
Fetches typeahead query suggestions for a partial query string, based
on the index’s query history and/or document fields.
Provide the implementation with
Effect.provide(AWS.Kendra.GetQuerySuggestionsHttp).
GetQuerySuggestions: Query Suggestions
Section titled “GetQuerySuggestions: Query Suggestions”const suggest = yield* AWS.Kendra.GetQuerySuggestions(index);
const { Suggestions } = yield* suggest({ QueryText: "how to conf" });GetSnapshots
Section titled “GetSnapshots”Source:
src/AWS/Kendra/GetSnapshots.ts
Runtime binding for the GetSnapshots operation (IAM action
kendra:GetSnapshots), scoped to one Index.
Fetches search-analytics metric snapshots for the index (click-through
rate, zero-result queries, top queries, …) over a time interval.
Provide the implementation with
Effect.provide(AWS.Kendra.GetSnapshotsHttp).
GetSnapshots: Search Analytics
Section titled “GetSnapshots: Search Analytics”const getSnapshots = yield* AWS.Kendra.GetSnapshots(index);
const metrics = yield* getSnapshots({ Interval: "ONE_WEEK_AGO", MetricType: "QUERIES_BY_COUNT",});ListAccessControlConfigurations
Section titled “ListAccessControlConfigurations”Source:
src/AWS/Kendra/ListAccessControlConfigurations.ts
Runtime binding for the ListAccessControlConfigurations operation (IAM action
kendra:ListAccessControlConfigurations), scoped to one Index.
Lists the index’s access-control configurations.
Provide the implementation with
Effect.provide(AWS.Kendra.ListAccessControlConfigurationsHttp).
ListAccessControlConfigurations: Access Control Configurations
Section titled “ListAccessControlConfigurations: Access Control Configurations”const listAcls = yield* AWS.Kendra.ListAccessControlConfigurations(index);
const { AccessControlConfigurations } = yield* listAcls();ListDataSourceSyncJobs
Section titled “ListDataSourceSyncJobs”Source:
src/AWS/Kendra/ListDataSourceSyncJobs.ts
Runtime binding for the ListDataSourceSyncJobs operation (IAM action
kendra:ListDataSourceSyncJobs), scoped to one DataSource.
Lists the data source’s sync-job history — status, error details, and
per-run document add/modify/delete/fail metrics.
Provide the implementation with
Effect.provide(AWS.Kendra.ListDataSourceSyncJobsHttp).
ListDataSourceSyncJobs: Syncing Data Sources
Section titled “ListDataSourceSyncJobs: Syncing Data Sources”const listSyncJobs = yield* AWS.Kendra.ListDataSourceSyncJobs(source);
const jobs = yield* listSyncJobs({ StatusFilter: "SUCCEEDED" });console.log(jobs.History?.[0]?.Metrics);ListGroupsOlderThanOrderingId
Section titled “ListGroupsOlderThanOrderingId”Source:
src/AWS/Kendra/ListGroupsOlderThanOrderingId.ts
Runtime binding for the ListGroupsOlderThanOrderingId operation (IAM action
kendra:ListGroupsOlderThanOrderingId), scoped to one Index.
Lists groups whose principal mapping is older than the given ordering
id — used to find stale group mappings to refresh or delete.
Provide the implementation with
Effect.provide(AWS.Kendra.ListGroupsOlderThanOrderingIdHttp).
ListGroupsOlderThanOrderingId: Principal Mapping
Section titled “ListGroupsOlderThanOrderingId: Principal Mapping”const listGroups = yield* AWS.Kendra.ListGroupsOlderThanOrderingId(index);
const stale = yield* listGroups({ OrderingId: orderingId });console.log(stale.GroupsSummaries);PutPrincipalMapping
Section titled “PutPrincipalMapping”Source:
src/AWS/Kendra/PutPrincipalMapping.ts
Runtime binding for the PutPrincipalMapping operation (IAM action
kendra:PutPrincipalMapping), scoped to one Index.
Maps users to groups (optionally per data source) so queries filtered
on the user’s context only return documents that user’s groups may
access.
Provide the implementation with
Effect.provide(AWS.Kendra.PutPrincipalMappingHttp).
PutPrincipalMapping: Principal Mapping
Section titled “PutPrincipalMapping: Principal Mapping”const putPrincipalMapping = yield* AWS.Kendra.PutPrincipalMapping(index);
yield* putPrincipalMapping({ GroupId: "engineering", GroupMembers: { MemberUsers: [{ UserId: "user@example.com" }], },});Source:
src/AWS/Kendra/Query.ts
Runtime binding for the Query operation (IAM action
kendra:Query), scoped to one Index.
Searches the index with a natural-language query — returns ranked
answers, FAQ matches, and document results, optionally filtered on
document attributes and the querying user’s context.
Provide the implementation with
Effect.provide(AWS.Kendra.QueryHttp).
Query: Querying an Index
Section titled “Query: Querying an Index”const query = yield* AWS.Kendra.Query(index);
const results = yield* query({ QueryText: "how do I configure SSO?" });for (const item of results.ResultItems ?? []) { console.log(item.Type, item.DocumentTitle?.Text);}Retrieve
Section titled “Retrieve”Source:
src/AWS/Kendra/Retrieve.ts
Runtime binding for the Retrieve operation (IAM action
kendra:Retrieve), scoped to one Index.
Retrieves up to 100 semantically-relevant passages (200-token excerpts)
from the index — the building block for retrieval-augmented generation
(RAG) over documents synced into Kendra.
Provide the implementation with
Effect.provide(AWS.Kendra.RetrieveHttp).
Retrieve: Querying an Index
Section titled “Retrieve: Querying an Index”const retrieve = yield* AWS.Kendra.Retrieve(index);
const passages = yield* retrieve({ QueryText: "vacation policy" });const context = (passages.ResultItems ?? []) .map((item) => item.Content) .join("\n");Source:
src/AWS/Kendra/SearchIndex.ts
An Amazon Kendra index — a machine-learning powered enterprise search index that data sources (S3, SharePoint, databases, …) sync documents into and that applications query with natural language.
Index: Creating Indexes
Section titled “Index: Creating Indexes”import * as AWS from "alchemy/AWS";
const role = yield* AWS.IAM.Role("KendraRole", { assumeRolePolicy: { Version: "2012-10-17", Statement: [{ Effect: "Allow", Principal: { Service: "kendra.amazonaws.com" }, Action: "sts:AssumeRole", }], }, policies: [{ policyName: "logs", policyDocument: { Version: "2012-10-17", Statement: [{ Effect: "Allow", Action: ["logs:*", "cloudwatch:PutMetricData"], Resource: "*", }], }, }],});
const index = yield* AWS.Kendra.Index("Search", { edition: "DEVELOPER_EDITION", roleArn: role.roleArn,});StartDataSourceSyncJob
Section titled “StartDataSourceSyncJob”Source:
src/AWS/Kendra/StartDataSourceSyncJob.ts
Runtime binding for the StartDataSourceSyncJob operation (IAM action
kendra:StartDataSourceSyncJob), scoped to one DataSource.
Starts an on-demand sync of the data source into its index — the
programmatic alternative to the data source’s cron schedule. Fails
with ResourceInUseException while another sync is already running.
Provide the implementation with
Effect.provide(AWS.Kendra.StartDataSourceSyncJobHttp).
StartDataSourceSyncJob: Syncing Data Sources
Section titled “StartDataSourceSyncJob: Syncing Data Sources”const startSync = yield* AWS.Kendra.StartDataSourceSyncJob(source);
const { ExecutionId } = yield* startSync();StopDataSourceSyncJob
Section titled “StopDataSourceSyncJob”Source:
src/AWS/Kendra/StopDataSourceSyncJob.ts
Runtime binding for the StopDataSourceSyncJob operation (IAM action
kendra:StopDataSourceSyncJob), scoped to one DataSource.
Stops the data source’s currently-running sync job, if any.
Provide the implementation with
Effect.provide(AWS.Kendra.StopDataSourceSyncJobHttp).
StopDataSourceSyncJob: Syncing Data Sources
Section titled “StopDataSourceSyncJob: Syncing Data Sources”const stopSync = yield* AWS.Kendra.StopDataSourceSyncJob(source);
yield* stopSync();SubmitFeedback
Section titled “SubmitFeedback”Source:
src/AWS/Kendra/SubmitFeedback.ts
Runtime binding for the SubmitFeedback operation (IAM action
kendra:SubmitFeedback), scoped to one Index.
Submits click and relevance feedback for a query’s results — Kendra
uses it to tune the index’s relevance over time (incremental learning).
Provide the implementation with
Effect.provide(AWS.Kendra.SubmitFeedbackHttp).
SubmitFeedback: Querying an Index
Section titled “SubmitFeedback: Querying an Index”const submitFeedback = yield* AWS.Kendra.SubmitFeedback(index);
yield* submitFeedback({ QueryId: queryId, ClickFeedbackItems: [{ ResultId: resultId, ClickTime: new Date() }],});UpdateAccessControlConfiguration
Section titled “UpdateAccessControlConfiguration”Source:
src/AWS/Kendra/UpdateAccessControlConfiguration.ts
Runtime binding for the UpdateAccessControlConfiguration operation (IAM action
kendra:UpdateAccessControlConfiguration), scoped to one Index.
Updates an access-control configuration’s name, description, or
user/group ACLs.
Provide the implementation with
Effect.provide(AWS.Kendra.UpdateAccessControlConfigurationHttp).
UpdateAccessControlConfiguration: Access Control Configurations
Section titled “UpdateAccessControlConfiguration: Access Control Configurations”const updateAcl = yield* AWS.Kendra.UpdateAccessControlConfiguration(index);
yield* updateAcl({ Id: configurationId, AccessControlList: [{ Name: "sam", Type: "USER", Access: "ALLOW" }],});UpdateQuerySuggestionsConfig
Section titled “UpdateQuerySuggestionsConfig”Source:
src/AWS/Kendra/UpdateQuerySuggestionsConfig.ts
Runtime binding for the UpdateQuerySuggestionsConfig operation (IAM action
kendra:UpdateQuerySuggestionsConfig), scoped to one Index.
Tunes the index’s query-suggestions settings — switch between
ENABLED and LEARN_ONLY, adjust the query-log look-back window, or
change minimum query thresholds.
Provide the implementation with
Effect.provide(AWS.Kendra.UpdateQuerySuggestionsConfigHttp).
UpdateQuerySuggestionsConfig: Query Suggestions
Section titled “UpdateQuerySuggestionsConfig: Query Suggestions”const updateSuggestions = yield* AWS.Kendra.UpdateQuerySuggestionsConfig(index);
yield* updateSuggestions({ Mode: "LEARN_ONLY", queryLogLookBackWindow: "14 days", MinimumNumberOfQueryingUsers: 2,});