0
votes

I've a Dynamodb table with two global secondary indexes. and I need to query this table based only on both of those indexes at once without using the hash key of the table. Is there any particular way to do this in AWS sdk for .net? It seems this is impossible in high level API.

eg:-(SQL equivalent query would be:-) SELECT * FROM TABLE WHERE FIRST_GLOBAL_SECONDARY_INDEX='x' AND SECOND_GLOBAL_SECONDARY_INDEX='y';

1
Can you explain what you mean by FIRST_GLOBAL_SECONDARY_INDEX='x' ? Does that mean the hash of the GSI? hash+range?mkobit

1 Answers

2
votes

You can only query a single GSI, not multiple. You would have to project the 2nd attribute (I'm assuming by other GSI you mean another attribute) onto the 1st index. Choosing which depends on your usage. Then, you have both attributes on a single index which you can query with the hashKey of the first attribute and use a FilterExpression for the second attribute.