Я пытаюсь создать таблицу с глобальным средним индексом с помощью яваскрипта SDK внутри nodejs:создать таблицу с глобальной средней ошибкой индекса
var messagesTableParams = {
TableName : "Messages",
KeySchema: [
{ AttributeName: "to", KeyType: "HASH"}, //Partition key
{ AttributeName: "tm", KeyType: "RANGE" } //Sort key
],
AttributeDefinitions: [
{ AttributeName: "to", AttributeType: "N" },
{ AttributeName: "tm", AttributeType: "N" }
],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
},
GlobalSecondaryIndexes: [
{
IndexName: 'fr_indx',
KeySchema: [
{ AttributeName: "fr", KeyType: "HASH"}, //Partition key
{ AttributeName: "tm", KeyType: "RANGE" } //Sort key
],
AttributeDefinitions: [
{ AttributeName: "fr", AttributeType: "N" },
{ AttributeName: "tm", AttributeType: "N" }
],
Projection: {
ProjectionType: 'KEYS_ONLY'
},
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
}
}
]
};
dynamodb.createTable(messagesTableParams, function(err, data) {
if (err) {
console.error("Unable to create table. Error JSON:", JSON.stringify(err, null, 2));
} else {
console.log("Created table. Table description JSON:", JSON.stringify(data, null, 2));
}
});
Но я получаю следующее сообщение об ошибке и таблица не создано:
Невозможно создать таблицу. Ошибка JSON: {«сообщение»: «Неожиданный ключ « Определения атрибутов »найдено в params.GlobalSecondaryIndexes [0]»,
«код»: «Неожиданный параметр», «время»: «2016-01-07T18: 51: 11.659Z "}