简体   繁体   English

存储和搜索股票代码 AWS 架构 - Elasticsearch 或 DynamoDB

[英]Store and Search Stock Symbols AWS Architecture - Elasticsearch or DynamoDB

I have an external API to synchronize all the Stock Symbols from all markets (NASDAQ, NYSE...).我有一个外部 API 来同步所有市场(纳斯达克、纽约证券交易所...)的所有股票代码。 I have an AWS Lambda to get this data from the external API.我有一个 AWS Lambda 从外部 API 获取这些数据。

Then I want a frontend website with a search bar, where the user can type "Tes" and it should appear automatically some suggestions, just like "Tesla" or "TESO" or other companies starting with "Tes".然后我想要一个带有搜索栏的前端网站,用户可以在其中键入“Tes” ,它应该会自动出现一些建议,就像“Tesla”“TESO”或其他以“Tes”开头的公司一样。

My doubt is in Backend.我的疑问在后端。 Where should I store these symbols?我应该在哪里存储这些符号? in DynamoDB or ElasticSearch?在 DynamoDB 或 ElasticSearch 中? Do you know of another AWS service that is better suited for this scenario?您是否知道另一种更适合这种情况的 AWS 服务?

I was thinking in store in DynamoDb, using the symbol as Primary Key, but then we cannot search by "Tes" without a full scan.我在考虑在 DynamoDb 中存储,使用符号作为主键,但是如果没有完整扫描我们就无法通过“Tes”进行搜索。 With Elasticsearch I don't have experience.使用 Elasticsearch 我没有经验。

Opensearch is what you need, which is also serverless now which makes it a good fit for serverless architectures. Opensearch 是您所需要的,它现在也是无服务器的,这使得它非常适合无服务器架构。 Using DynamoDB streams, you can easily stream data into OpenSearch.使用 DynamoDB 流,您可以轻松地将 stream 数据导入 OpenSearch。 Code pointers here:代码指针在这里:

https://docs.aws.amazon.com/opensearch-service/latest/developerguide/integrations.html https://docs.aws.amazon.com/opensearch-service/latest/developerguide/integrations.html

And this workshop will provide you with the necessary information and tools to be successful. 本次研讨会将为您提供成功所需的信息和工具。

If you are open to non AWS services, I would recommend typesense of meilisearch.如果你对非 AWS 服务持开放态度,我会推荐 meilisearch 的 typesense。 They are much better products for this use case than Elasticsearh is.对于这个用例,它们是比 Elasticsearch 更好的产品。

For transient data, consider using AWS ElastiCache .对于瞬态数据,请考虑使用AWS ElastiCache It's a key value store that runs on top of Redis or Memcached.它是在 Redis 或 Memcached 之上运行的键值存储。 You can use the symbol as key and store the running stock price as value.您可以使用符号作为键并将运行中的股票价格存储为值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM