Amazon dynamodb 在dynamo db中存储新闻数据时需要使用哪些键?

Amazon dynamodb 在dynamo db中存储新闻数据时需要使用哪些键?,amazon-dynamodb,Amazon Dynamodb,我需要一些关于如何在Dynamo DB中存储新闻记录的指导 { "news": [{ "id": "nws_7KnqNr", "title": "Dow Jones Futures: From Apple To Zscaler, This Is The New Stock Market Trend", "publication_date": "2019-09-11T10:46:24.000Z", "url": "https:

我需要一些关于如何在Dynamo DB中存储新闻记录的指导

{
    "news": [{
        "id": "nws_7KnqNr",
        "title": "Dow Jones Futures: From Apple To Zscaler, This Is The New Stock Market Trend",
        "publication_date": "2019-09-11T10:46:24.000Z",
        "url": "https://finance.yahoo.com/m/c5f84bed-ce61-3938-9af1-953d15dbcf65/dow-jones-futures%3A-from-apple.html?.tsrc=rss",
        "summary": "Dow Jones futures: From low Apple TV+ pricing to Roku's sell-off and Ally Financial's breakout, value is in. Already-reeling Zscaler plunged on guidance. RH fell too."
    }],
    "company": {
        "id": "com_NX6GzO",
        "ticker": "AAPL",
        "name": "Apple Inc",
        "lei": "HWUPKR0MPOU8FGXBT394",
        "cik": "0000320193"
    },
    "next_page": "MjAxOS0wOS0xMSAxMDo0NjoyNCBVVEN8NTM1NDYzNg=="
}
这是示例JSON

新闻是从一些API中提取的,应该存储在Dynamo DB中

{
    "news": [{
        "id": "nws_7KnqNr",
        "title": "Dow Jones Futures: From Apple To Zscaler, This Is The New Stock Market Trend",
        "publication_date": "2019-09-11T10:46:24.000Z",
        "url": "https://finance.yahoo.com/m/c5f84bed-ce61-3938-9af1-953d15dbcf65/dow-jones-futures%3A-from-apple.html?.tsrc=rss",
        "summary": "Dow Jones futures: From low Apple TV+ pricing to Roku's sell-off and Ally Financial's breakout, value is in. Already-reeling Zscaler plunged on guidance. RH fell too."
    }],
    "company": {
        "id": "com_NX6GzO",
        "ticker": "AAPL",
        "name": "Apple Inc",
        "lei": "HWUPKR0MPOU8FGXBT394",
        "cik": "0000320193"
    },
    "next_page": "MjAxOS0wOS0xMSAxMDo0NjoyNCBVVEN8NTM1NDYzNg=="
}
为了高效检索,需要制作哪些密钥? 新闻也可以按公司获取

News
----------
id (hash key)
title
publication_date
url 
summary
company_id (index - hash key)
我们应该做到这一点。因此,“news”数组中的每个元素都会带着公司id出现在这里。如果您想通过新闻id进行获取,您可以高效地通过公司id进行获取(因为索引)

如果有几家大公司的新闻最多(比如苹果),而你有很多数据,那么该指数就会出现问题

为了解决这个问题,请使用

company_by_month_id (index - hash key)
这是一个复合键

更新:

company_name (index - hash key + timestamp as sort key)
ticker (index - hash key + timestamp as sort key)
timestamp (this is generated)

查询创建的两个索引,以获取基于公司名称或股票代码的最新新闻。

感谢Horatiu Jeflea的回复。由于除了公司名称或股票代码外,没有基于新闻参数的新闻过滤器,所以我可以将它们设置为仅排序键吗?您需要更准确的查询是什么?要获取所有新闻,请按公司名称获取所有新闻?根据要求,新闻需要按公司名称获取