1

As I come from RDBM background I am bit confuse with DynamoDB, how to write this query.

Problem : need to filter out those data which is more than 15 minutes.

I have created GSI with hashkeymaterialType and createTime (create time format Instant.now().toEpochMilli()).

Now I have to write a java query which gives those values which is more than 15 minutes.

Shawn
  • 4,064
  • 2
  • 11
  • 23
Yashika Chandra
  • 163
  • 3
  • 13

1 Answers1

1

Here is an example using cli.

:v1 should be the material type I'd that you are searching on. :v2 should be your epoch time in milliseconds for 30 mins ago which you will have to calculate.

aws dynamodb query \
    --table-name mytable \
    --index-name myindex
    --key-condition-expression "materialType = :v1 AND create time > :v2" \
    --expression-attribute-values '{
    ":v1": {"S": "some id"},
    ":V2": {"N": "766677876567"}
}'
Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31