Joe Dee
Joe Dee

Reputation: 71

batchGetItem error when not providing range key

I have a table with a Hash Key and Range Key and I'm attempting to do a batchGetItem.

When I provide a Range Key, I get results from the query:

var params = {
                "RequestItems": {
                    "properties": {
                        "Keys": [{
                            "propertyID": {
                                "S": "11937282"
                            },
                            "createdAt": {
                                "N": "1391280948445"
                            }
                        }, {
                            "propertyID": {
                                "S": "11937225"
                            },
                            "createdAt": {
                                "N": "1391355074910"
                            }
                        }]
                    }
                }
            }

When I don't specify the Range Key, I get an error: 'The provided key element does not match the schema'

var params = {
                    "RequestItems": {
                        "properties": {
                            "Keys": [{
                                "propertyID": {
                                    "S": "11937282"
                                }
                            }, {
                                "propertyID": {
                                    "S": "11937225"
                                }
                            }]
                        }
                    }
                }

According to the docs you only provide the primary key. Any ideas?

Upvotes: 0

Views: 1102

Answers (1)

aaaristo
aaaristo

Reputation: 2169

BatchGetItem enables you to get N items at once but you have to specify the complete Key of every item you want to get.

If you are trying to get all the items within some hash key, you have to use the Query API instead.

Upvotes: 3

Related Questions