问题描述
我正在大量使用 Dynamo DB 来构建我正在构建的服务.一个新的客户请求进来了,需要云搜索.我看到可以通过 AWS 控制台从发电机表创建云搜索域.
I'm using Dynamo DB pretty heavily for a service I'm building. A new client request has come in that requires cloud search. I see that a cloud search domain can be created from a dynamo table via the AWS console.
我的问题是这样的:
有没有办法通过 API 或以其他方式在指定的位置自动将数据从 dynamo 表卸载到云搜索域时间间隔?
比起手动将 dynamo 文档卸载到 cloudsearch,我更愿意这样做.非常感谢所有帮助!
I'd prefer this to manually offloading dynamo documents to cloudsearch. All help greatly appreciated!
推荐答案
这里有两个想法.
使用 CloudSearch 搜索 DynamoDB 数据的官方 AWS 方式
The official AWS way of searching DynamoDB data with CloudSearch
这种方法在 http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-dynamodb-data.html.
缺点是这听起来很痛苦:您必须重新创建新的搜索域或维护更新表才能同步,并且您需要一个 cron 作业或其他东西来执行脚本.
The downside is that it sounds like a huge pain: you have to either re-create new search domains or maintain an update table in order to sync, and you'd need a cron job or something to execute the script.
AWS Lambdas 方式
The AWS Lambdas way
使用新的 Lambdas 事件处理服务.设置基于 Dynamo 的事件流非常简单(请参阅 http://docs.aws.amazon.com/lambda/latest/dg/wt-ddb.html).
Use the newish Lambdas event processing service. It is pretty simple to set up an event stream based on Dynamo (see http://docs.aws.amazon.com/lambda/latest/dg/wt-ddb.html).
然后,您的 Lambda 将根据 Dynamo 事件向 CloudSearch 提交搜索文档.有关从 Lambda 提交文档的示例,请参阅 https://gist.github.com/fzakaria/4f93a8dbf483695fb7d5
Your Lambda would then submit a search document to CloudSearch based on the Dynamo event. For an example of submitting a document from a Lambda, see https://gist.github.com/fzakaria/4f93a8dbf483695fb7d5
在我看来,这种方法要好得多,因为它会不断更新您的搜索索引,而无需您参与.
This approach is a lot nicer in my opinion as it would continuously update your search index without any involvement from you.
这篇关于自动卸载发电机表到云搜索域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!