I have a table with hash and range primary key. I need to query by eventDate and customerId. Here is the structure. Hash is an uniqueId formatted like UUID, range is a customerId. Also I have LSI with range key eventDate. I want to make a query with param:
'KeyConditionExpression' => "customerId = :customer_id"
But I got an error:
Query condition missed key schema element: uniqueId
You may say I shouldn't use useless hashes but what should I do then? Before that I tried to use hash and range customerId, eventDate but I was not able to use them since it is not guaranted that eventDate will be unique. This means if three events were generated at the same time then only the last one was saved.
Is there a way to combine such structure with dynamodb?