To me, the word "hash" conveys that it IS possible to a hash consisting of multiple fields within DynamoDB. However, every article I find shows the "hash" consisting of only a single value... which doesn't make any sense to me.
My table consists of the following fields:
- uid (PK)
- provider
- identifier
- from
- to
- date_received
- date_processed
The goal is to have multiple indexes based on how my app will retrieve data (other than by the PK, of course). The combinations are:
By the providers's message identifier:
Desired hash: provider + identifierBy the conversation message identifier:
Desired hash: from + toBy the date received and if is is processed
Desired hash: _acBy the date received and if is is processed
Desired hash: account
Here's an one of the examples of what I've tried and were not successful ...
MessagesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: messages
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: uid
AttributeType: S
- AttributeName: account
AttributeType: S
- AttributeName: provider
AttributeType: S
- AttributeName: identifier
AttributeType: S
- AttributeName: from
AttributeType: N
- AttributeName: to
AttributeType: N
- AttributeName: _ac
AttributeType: N
- AttributeName: _ap
AttributeType: N
KeySchema:
- AttributeName: uid
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: idxConversation
KeySchema:
- AttributeName: from:to
KeyType: HASH
- AttributeName: _ac
KeyType: RANGE
Projection:
ProjectionType: KEYS_ONLY
- IndexName: idxProviderMessage
KeySchema:
- AttributeName: provider:identifier
KeyType: HASH
- AttributeName: _ac
KeyType: RANGE
Projection:
ProjectionType: KEYS_ONLY