@indexes

Defines Global Secondary Indexes for your project's DynamoDB tables. @indexes should only ever be paired with @tables.

DynamoDB is a powerful database, though different from both SQL and NoSQL databases. It is highly recommended to dig into Amazon's resources to familiarize yourself with it:

Syntax

Example

The following app.arc file defines a DynamoDB table with two Global Secondary Indexes:

arc
@app
testapp

@tables
accounts
  accountID *String

@indexes
accounts
  email *String
  name byEmail

accounts
  created *String
  name byDate
json
{
  "app": "testapp",
  "tables": [
    { "accounts": { "accountID": "*String" } }
  ],
  "indexes": [
    { "accounts": { "email": "*String", "name": "byEmail" } },
    { "accounts": { "created": "*String", "name": "byDate" } }
  ]
}
toml
app="testapp"

[[tables]]
[tables.accounts]
accountID="*String"

indexes = [
{ "accounts" = { "email" = "*String", "name" = "byEmail" } },
{ "accounts" = { "created" = "*String", "name" = "byDate" } }
]
yaml
---
app: testapp

tables:
- accounts:
    accountID: "*String"

indexes:
- accounts:
  - email: "*String"
  - name: "byEmail"
- accounts:
  - created: "*String"
  - name: "byDate"