没有哈希键条件适用于指定的索引



我正在尝试使用具有索引名称和对象中定义secondryGlobalIndex的查询表达式从dynamoDB进行查询。

但回应是

非法查询表达式:没有哈希键条件适用于 指定索引

我正在使用的代码

DynamoDBQueryExpression queryExpression = new DynamoDBQueryExpression()
            .withHashKeyValues(valueObject)
            .withIndexName("postID-commentTime-index")
            .withConsistentRead(false);

    try {
        PaginatedQueryList<ValueObject> result = 
(PaginatedQueryList) mapper.query(valueObjectClass, queryExpression);

查询索引时的关键条件与索引的架构有关,而不是基表的架构。确保传递到查询中的关键条件是索引,而不是基表。

最新更新