How can I store the private vector data in Opensearch per user?



I'm building a RAG approach AI feature. I did a test with AWS Bedrock creating a knowledgebase that gets the data from a S3 bucket. Then the data is sent to opensearch and store as vectors.

I would like to know if there is the possibility of storing that data in Opensearch in a private way, so later each user can get the response of his own data from the chatbot UI Im building. The user A will ask a question, and it should receive only the response based on his data, and then same should happen with the user B.

There is a way to achieve that? And is so how can I separate that data in Opensearch? I'm using Python with langchain.

Thank you guys!

1 Answer
Accepted Answer


Rather than OpenSearch, did you explore the pgvector extension of PostgreSQL: it is available on AWS RDS. See or

This blog post will also detail the approach:

The ability to add columns to your relational tables identifying different users will allow you to obtain the separation that you want.



profile pictureAWS
answered 3 months ago
profile picture
reviewed 3 months ago
  • Hey! An update here. I used this approach and it worked as I needed, thank you!

  • Hi again! I was doing some tests and I loaded a very long excel file into my pgvector postgresql database. Then I did a query to get the embeddings by the user id, and got the response, but when calling bedrock I got an exception. ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModel operation: Input is too long for requested model.

    How can I manage large volume of data with this approach using RAG?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions