SearchContentCommand

Searches for content in a specified knowledge base. Can be used to get a specific content resource by its name.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { QConnectClient, SearchContentCommand } from "@aws-sdk/client-qconnect"; // ES Modules import
// const { QConnectClient, SearchContentCommand } = require("@aws-sdk/client-qconnect"); // CommonJS import
const client = new QConnectClient(config);
const input = { // SearchContentRequest
  nextToken: "STRING_VALUE",
  maxResults: Number("int"),
  knowledgeBaseId: "STRING_VALUE", // required
  searchExpression: { // SearchExpression
    filters: [ // FilterList // required
      { // Filter
        field: "STRING_VALUE", // required
        operator: "STRING_VALUE", // required
        value: "STRING_VALUE", // required
      },
    ],
  },
};
const command = new SearchContentCommand(input);
const response = await client.send(command);
// { // SearchContentResponse
//   contentSummaries: [ // ContentSummaryList // required
//     { // ContentSummary
//       contentArn: "STRING_VALUE", // required
//       contentId: "STRING_VALUE", // required
//       knowledgeBaseArn: "STRING_VALUE", // required
//       knowledgeBaseId: "STRING_VALUE", // required
//       name: "STRING_VALUE", // required
//       revisionId: "STRING_VALUE", // required
//       title: "STRING_VALUE", // required
//       contentType: "STRING_VALUE", // required
//       status: "STRING_VALUE", // required
//       metadata: { // ContentMetadata // required
//         "<keys>": "STRING_VALUE",
//       },
//       tags: { // Tags
//         "<keys>": "STRING_VALUE",
//       },
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

SearchContentCommand Input

See SearchContentCommandInput for more details

Parameter
Type
Description
knowledgeBaseId
Required
string | undefined

The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base. Can be either the ID or the ARN. URLs cannot contain the ARN.

searchExpression
Required
SearchExpression | undefined

The search expression to filter results.

maxResults
number | undefined

The maximum number of results to return per page.

nextToken
string | undefined

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

SearchContentCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
contentSummaries
Required
ContentSummary[] | undefined

Summary information about the content.

nextToken
string | undefined

If there are additional results, this is the token for the next set of results.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

ResourceNotFoundException
client

The specified resource does not exist.

ValidationException
client

The input fails to satisfy the constraints specified by a service.

QConnectServiceException
Base exception class for all service exceptions from QConnect service.