gpt4 book ai didi

amazon-web-services - DynamoDB 在 map 或列表类型上创建索引

转载 作者:行者123 更新时间:2023-12-03 08:30:06 26 4
gpt4 key购买 nike

我正在尝试向 DynamoDB 中 map 对象内的属性添加索引,但似乎找不到这样做的方法。这是支持的东西还是索引真的只允许用于标量值?围绕此的文档似乎非常稀少。我希望索引功能类似于 MongoDB,但到目前为止,我所采用的使用点语法将属性引用到索引的方法还没有成功。任何可以提供的帮助或其他信息表示赞赏。

最佳答案

索引只能建立在顶级 JSON 属性上。此外,范围键必须是 DynamoDB 中的标量值(字符串、数字、二进制或 bool 值之一)。

来自 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: What data types can be indexed?

All scalar data types (Number, String, Binary, and Boolean) can be used for the range key element of the local secondary index key. Set, list, and map types cannot be indexed.

关于amazon-web-services - DynamoDB 在 map 或列表类型上创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30261734/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com