json - 如何在 C# 中为 Amazon Dynamo DB 中的 Json 属性(列值)创建全局二级索引?

标签 json amazon-web-services indexing amazon amazon-dynamodb

我有一个包含列 Id 和 JSON 列的表。

Id       |       JSON
----------------------------------------------------------------
101      |  {"person_id":456,"f_name":"t", "l_name":"Jack"}
         |
102      |  {"person_id":123,"f_name":"M", "l_name":"Ron"}
         |
103      |  {"person_id":789,"f_name":"A", "l_name":"Tom"}

我能够在 Id 列上创建 GSI(全局二级索引),但我想知道如何在 person_idf_name 上创建 GSI。是否可以为 json 属性创建 GSI?根据观察,我能够在 Dynamo DB 表中的列上创建 GSI ..请提供 C#.Net 示例 DynamoDB ..

最佳答案

取自 http://aws.amazon.com/dynamodb/faqs/

Q: Is querying JSON data in DynamoDB any different?

No. You can create a Global Secondary Index or Local Secondary Index on any top-level JSON element. For example, suppose you stored a JSON document that contained the following information about a person: First Name, Last Name, Zip Code, and a list of all of their friends. First Name, Last Name and Zip code would be top-level JSON elements. You could create an index to let you query based on First Name, Last Name, or Zip Code. The list of friends is not a top-level element, therefore you cannot index the list of friends. For more information on Global Secondary Indexing and its query capabilities, see the Secondary Indexes section in this FAQ.

Q: If I have nested JSON data in DynamoDB, can I retrieve only a specific element of that data?

Yes. When using the GetItem, BatchGetItem, Query, or Scan APIs, you can define a ProjectionExpression to determine which attributes should be retrieved from the table. Those attributes can include scalars, sets, or elements of a JSON document.



虽然我还没有设法做到,或者看到任何通过云形成完成的例子。

关于json - 如何在 C# 中为 Amazon Dynamo DB 中的 Json 属性(列值)创建全局二级索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34287356/

相关文章:

android - 在android中用jsonarray解析json对象

javascript - 神秘的ajax json请求问题jQuery

PostgreSQL pgAdmin III SSL 连接到 AWS RDS 实例

amazon-web-services - AWS SAM YAML 文件无法引用 S3 事件的现有存储桶

mysql - 为什么索引使用取决于列类型

c# - DataContractJsonSerializer 设置值扩展点

java 8 - javax.json - 如何从预制 JSON 中获取特定值

amazon-web-services - Amazon S3 存储桶策略不支持 "version"选项

arrays - jq 输出空字符串时 bash readarray -t 数组赋值的问题

c - C 中的二维数组索引怎么样?