1

I am referring to a thread creating an index with JSON

I have a column called data in my DynamoDB table. This is in JSON and the structure of this file looks like this:

{
"config": "aasdfds",
"state":"PROCESSED",
"value" "asfdasasdf"
}

The AWS documentation says that I can create an index with the top level JSON attribute. However I don't know how to do this exactly. When I create the index, should I specify the partition key as data.state, then, in my code, use a query with the column data.state with the value set to PROCESSED, or should I create the partition key as data, then, in my code, look for the column data with the value set to state = "PROCESSED" ?

1 Answer 1

4

Top level attribute means DynamoDB supports creating index on Scalar attributes only (String, Number, or Binary).

The JSON attribute is stored as Document data type. So, index can't be created on Document data type.

The key schema for the index. Every attribute in the index key schema must be a top-level attribute of type String, Number, or Binary. Other data types, including documents and sets, are not allowed.

Scalar Types – A scalar type can represent exactly one value. The scalar types are number, string, binary, Boolean, and null.

Document Types – A document type can represent a complex structure with nested attributes—such as you would find in a JSON document. The document types are list and map.

Set Types – A set type can represent multiple scalar values. The set types are string set, number set, and binary set.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.