awslabs / generative-ai-cdk-constructs

AWS Generative AI CDK Constructs are sample implementations of AWS CDK for common generative AI patterns.
https://awslabs.github.io/generative-ai-cdk-constructs/
Apache License 2.0
357 stars 50 forks source link

(OpenSearch): Metadata Field property not changed to filterable false #680

Open naerolf opened 2 months ago

naerolf commented 2 months ago

Describe the bug

When creating through CDK the OpenSearch index, assigning a metadata field to be non filterable in the code is not respected in the final deployment in console

Expected Behavior

When assigning a metadata field in OpenSearch through the construct deployment, to have the filterable field false as stated in the deployment code.

Current Behavior

When declaring in the sample AMAZON_BEDROCK_METADATA field, is expected to be not filterable through Knowledge Base metadata filters. Currently what happens is if we declare it false, the deployment automatically sets it to true as shown in the screenshot.

cdk_opensearch_issue

Reproduction Steps

vector_index = VectorIndex(self, config['OPENSEARCH_SERVERLESS']['vector_index_name'].lower(),
                                   vector_dimensions=1536,
                                   collection=vector_collection,
                                   index_name=config['OPENSEARCH_SERVERLESS']['vector_index_name'].lower(),
                                   vector_field=config['OPENSEARCH_SERVERLESS']['vector_field_name'].lower(),
                                   mappings=[
                                       MetadataManagementFieldProps(
                                           mapping_field='AMAZON_BEDROCK_TEXT_CHUNK',
                                           data_type='text',
                                           filterable=True
                                       ),
                                       MetadataManagementFieldProps(
                                           mapping_field='AMAZON_BEDROCK_METADATA',
                                           data_type='text',
                                           filterable=False
                                       )
                                   ]
                                   )

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.155.0

Framework Version

build 34dcc5a

Node.js Version

Node 18

OS

Mac OS 14.5 (23F79)

Language

Python

Language Version

No response

Region experiencing the issue

us-east-1

Code modification

No, it does not apply for the current issue.

Other information

No response

Service quota

krokoko commented 1 month ago

Hi @naerolf thank you for reporting this issue ! I will try to reproduce

krokoko commented 4 days ago

This is reproducible:

image

However when created through a KB, mapping is correct:

image