I have a single DynamoDB table which has data using the same partition key but different sort keys which stores different data structures based on the sort key. The structure of the table is similar shown below where different sort keys are used with the same partition key.
| id | type | customerId | items | additionalInfo | comments |
|---|---|---|---|---|---|
| cdd56430-5b57-4f2c-b831-5395db55d3cc | details | 1234 | some details | ||
| cdd56430-5b57-4f2c-b831-5395db55d3cc | inventory | [{"productId": 1, "count": 40}] | some details | ||
| afe92905-4b57-4e9d-9833-b77bd3c6e36f | details | 1234 | other details here | ||
| afe92905-4b57-4e9d-9833-b77bd3c6e36f | inventory | [{"productId": 2, "count": 100}] | some details |
I have a DynamoDB stream sending updates to a single OpenSearch index. Since these events use the same partition key, but different sort keys, each event will overwrite the data in the document stored in the index as the unique id for the document is only the partition key and not the sort key.
The goal is to index all data from this DynamoDB table into OpenSearch and be able to provide a plain text search for all data in the database.
In this scenario, would multiple indexes be used in OpenSearch and each index would be based on the sort key? If so, how would text searches be performed across multiple indexes and returned to the application?