0

I have a simple table on DynamoDB with an id and email

I think I created the indexes and now I just want to query for a specific item with a specific email value.

I keep getting errors on that and cant find the right way.

This is my "describe" of the table:

enter image description here

now how do I query for an item with an email value of "[email protected]"

any help will be highly appreciated!

1 Answer 1

1

You need to create another index (a Global Secondary Index) only on the email field, if you want to be able to query on only that field. You will have to specify the name of the index you want to use as part of the query.

Alternatively, you can do a scan instead of a query.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, can you share an example? And if I have other fields I need to do that for each one? And I thought i added a keyType range there
There are plenty of examples in the official DynamoDB documentation of this sort of thing. And yes you can only run a query against an index (again, this is covered very well in the documentation). docs.aws.amazon.com/amazondynamodb/latest/APIReference/… I don't know what you are asking about keyType. You created a composite primary key that consists of userId and email, so you would need to specify those fields if you want to query against that primary index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.