据我了解,我需要索引才能使用dynamodb查询(而非扫描)
目前,我将类似的内容用于扫描以搜索数据
const params = {
TableName: process.env.DYNAMODB_TABLE_LIGHTHOUSE,
FilterExpression: '#blickArticleId = :valblickArticleId AND #firstFolder = :valfirstFolder',
ExpressionAttributeNames: {
'#blickArticleId': 'blickArticleId',
'#firstFolder': 'firstFolder'
},
ExpressionAttributeValues: {
':valblickArticleId': 'null',
':valfirstFolder': 'null'
},
};
查询而不是扫描会是什么样?搜索具有上述条件的所有物品。
我是否需要更改无服务器yaml文件中的某些内容才能使其实现。
resources:
Resources:
DynamoDbTableExpenses:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
KeySchema:
-
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE_LIGHTHOUSE}
数据看起来像这样。我想查询所有除审计和分数之外的东西吗?
finalUrl "https://www.lalalala.ch/"
secondFolder "null"
subdomain "www"
audits {…}
host "lalalala"
fetchDate "2019-05-09"
scores {…}
firstFolder "null"
id "a25db7e0-7228-11e9-abbc-09b5d01bd824"
blickArticleId "null"
fetchTime "2019-05-09T07:03:24.851Z"
htmlReport "https://s3.eu-central-1.…-03---www_...l"