全局二级索引:所有索引中的预计属性数超过20的限制

时间:2017-03-28 09:36:13

标签: ruby amazon-web-services amazon-dynamodb

我正在尝试在包含30列的表上创建GSI(使用ruby SDK)。我使用projection_type:'ALL' - 但我仍然得到以下异常:

Aws::DynamoDB::Errors::ValidationException: One or more parameter values were invalid: Number of projected attributes in all indexes exceeds limit of 20, number of projected attributes:30

据我所知,这只应在使用INCLUDE projection_type:

时发生
  

此限制不适用于ProjectionType为KEYS_ONLY或ALL的二级索引。   http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes

create语句类似于:

connection.update_table({
    table_name: "my-table", # required
    attribute_definitions: [
      {
        attribute_name: "indexDate",
        attribute_type: "S",
      },
      {
        attribute_name: "createdAt",
        attribute_type: "S",
      },
    ],
    global_secondary_index_updates: [
      {
        create: {
          index_name: "my-new-index", # required
          key_schema: [
            {
              attribute_name: "indexDate",
              key_type: "HASH",
            },
            {
              attribute_name: "createdAt",
              key_type: "RANGE",
            },
          ],
          projection: { # required
            projection_type: "ALL"
          },
          provisioned_throughput: { # required
            read_capacity_units: 10, # required
            write_capacity_units: 300, # required
          }
        }
      }
    ]
  })

1 个答案:

答案 0 :(得分:0)

原来,属性限制限制遍及桌面上的所有GSI。我有另一个导致这个失败的人。删除了那个,然后就可以了。