在嵌套字段上建立索引

Indexing on nested field

我正在尝试使用 AWS 开发人员控制台中的仪表板在嵌套字段上创建索引。例如。如果我有以下模式:

{ 'id': 1,
  'nested': {
     'mode': 'mode1',
     'text': 'nice text' 
  }
}

我能够在 nested.mode 上创建索引,但是每当我通过索引进行查询时,都没有任何结果。这让我觉得 DynamoDB 在字段名称 nested.mode 而不是 nestedmode 字段上创建了索引。任何提示重新。我可能做错了什么?

您不能(目前)创建嵌套属性的二级索引。来自 Improving Data Access with Secondary Indexes in DynamoDB documentation(强调我的):

For each secondary index, you must specify the following:

...

  • 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. Nested attributes and multi-valued sets are not allowed. Other requirements for the key schema depend on the type of index:

但是,您可以