Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to search on nested property in DynamoDB AWS console

Is it possible to search on nested properties from AWS DynamoDB console? I am able to search on all top level properties, but search on any nested properties always results in empty result set.

For example for the document provided below I am able to scan and add filter on any top level field, like id, name, etc.

However I am unable to scan, and filter on device. I am trying the filter as device.name = 'Xaomi'

{ id: 'jhfdgu75457y8r', name: 'Parag', device: {name: 'Xaomi', country: 'China'} }

Please note that I am doing this from AWS console, and not any client library. Does AWS console allows filters on nested objects?

like image 249
parags Avatar asked Mar 17 '16 04:03

parags


People also ask

Does DynamoDB support nested objects?

In addition to simple data types like numbers and strings DynamoDB supports these types: Nested object: A value of an attribute in DynamoDB can be a complex nested object.

What are nested attributes in DynamoDB?

Nested attributes. An attribute is said to be nested if it is embedded within another attribute.

What does the Query operation in Amazon DynamoDB allow you to do?

The Query operation allows you to limit the number of items that it reads. To do this, set the Limit parameter to the maximum number of items that you want. For example, suppose that you Query a table, with a Limit value of 6 , and without a filter expression.


2 Answers

All data in DynamoDB is stored as either a string, binary or number.

When you use an SDK to access DynamoDB it will typically convert and unconvert these primatives into complex data types such as lists and maps.

The console works only on the primative data types. In this case your device attribute is treated as a string, and you cannot therefore filter by the device.name nested attribute.

You can however simply do a string filter. For example filter on the device attribute, using the contains operator and the value "name":"Xaomi"

like image 153
F_SO_K Avatar answered Sep 17 '22 22:09

F_SO_K


It isn't currently possible on the console.

I was also looking for a solution where I can find an item based on the value of a nested property.

But it is currently possible only via the SDK or CLI and not the console.

Confirmed by the AWS support team here - https://forums.aws.amazon.com/thread.jspa?messageID=931016

like image 20
thedreamsaver Avatar answered Sep 16 '22 22:09

thedreamsaver