Enabling document attributes for search - Amazon Q Business

Enabling document attributes for search

For STRING and STRING_LIST type attributes to be eligible for boosting, they must first be enabled for search in your Amazon Q index. To enable these attributes for search, use the DocumentAttributeConfiguration object of the UpdateIndex API operation.

The following sections provide AWS CLI examples of how to enable document attributes for search.

The following is an example of how to use the AWS CLI to enable for search the STRING type reserved document attribute _category and the STRING_LIST type reserved document attribute _authors by using the UpdateIndex API operation.

aws qbusiness update-index \ --application-id APPLICATION_ID \ --index-id INDEX_ID \ --document-attribute-configurations ' [ { "name": "_category", "type": "STRING", "search": "ENABLED" }, { "name": "_authors", "type": "STRING_LIST", "search": "ENABLED" } ]'

You can also enable custom document attributes for search using the DocumentAttributeConfiguration object of the UpdateIndex API operation.

The following is an example of how to use the AWS CLI to enable for search the custom STRING and STRING_LIST type document attributes using the UpdateIndex API operation.

aws qbusiness update-index \ --application-id APPLICATION_ID \ --index-id INDEX_ID \ --document-attribute-configurations ' [ { "name": "custom_string", "type": "STRING", "search": "ENABLED" }, { "name": "custom_string_list", "type": "STRING_LIST", "search": "ENABLED" } ]'

To check if a STRING or STRING_LIST type document attribute has been enabled for search successfully, use the GetIndex API operation.

aws qbusiness get-index \ --application-id APPLICATION_ID \ --index-id INDEX_ID

The AWS CLI returns the following type of response:

{ ... "documentAttributeConfigurations": [ { "name": "_authors", "search": "ENABLED", "type": "STRING_LIST" }, { "name": "_category", "search": "ENABLED", "type": "STRING" }, { "name": "_created_at", "search": "DISABLED", "type": "DATE" }, { "name": "_data_source_id", "search": "ENABLED", "type": "STRING" }, { "name": "_document_title", "search": "ENABLED", "type": "STRING" }, { "name": "_file_type", "search": "ENABLED", "type": "STRING" }, { "name": "_language_code", "search": "ENABLED", "type": "STRING" }, { "name": "_last_updated_at", "search": "DISABLED", "type": "DATE" }, { "name": "_source_uri", "search": "ENABLED", "type": "STRING" }, { "name": "_version", "search": "ENABLED", "type": "STRING" }, { "name": "_view_count", "search": "DISABLED", "type": "NUMBER" } ], ... }