Dynamodb query - OR condition in KeyConditionExpression

后端 未结 2 2033
栀梦
栀梦 2021-01-01 21:44

I have a DynamoDB table with feed_guid as the global secondary index. I want to query with a set of feed_guid in that table. Since feed_guid<

相关标签:
2条回答
  • 2021-01-01 22:08

    You can't use OR condition. You should use

    rangeAttributeName BETWEEN :rangeval1 AND :rangeval2
    

    if possible or

    feed_guid IN (:v_guid1, :v_guid2)
    

    See ExpressionAttributeValues and KeyConditionExpression

    0 讨论(0)
  • 2021-01-01 22:14

    In order to achieve what you want here, you'll need to take the union of two separate queries.

    Currently, DynamoDB's Query API only supports having one condition on Hash AND Range Keys in only the KeyConditionExpression because this limits the items you search and ultimately reduces cost of say a more complex query like what you've described here.

    0 讨论(0)
提交回复
热议问题