i have data in dynamodb table , trying filter based on data attributes. below example of json data. example filter query be: payload.stat > 200.
however, attempts use such query in dynamodb navigation pane not work , error: "an item consists of 1 or more attributes. each attribute consists of name, data type, , value. when read or write item, attributes required make primary key"
how can filter data using attributes within payload?
{ "payload": { "lock": "l1", "maxtmptr": 50, "serial": "sx001", "stat": 255, "timeover": 0.17, "tmptr": 30 }, "serial": "sx001", "timestamp": "1472784542467" }
screenshot of dynamodb table:
you can query or scan result using filterexpressions. when query dynamodb, partition key must. when scan dynamodb, partition key optional. scan slower query.
try this
var params = { "tablename": tablename, "filterexpression": "payload.lock = :val1 , timestamp = :val2", "expressionattributevalues": { ":val1": "lockinput", ":val1": "timestamp" }, "returnconsumedcapacity": "total" };
if need more filter options, can customize filterexpression.
Comments
Post a Comment