Full text search with CloudSearch and DynamoDB

488 Views Asked by At

I'm building an web app on AWS. One of the features that is required is a full text search capability for the users. For that reason I've configured dynamodb stream to trigger lambda that creates/updates cloudsearch indices whenever new record is created/updated in dynamodb.

Let's say I have a product record with fields on which I'd like to run the full text search, i.e.

description, name, tags

However, the product record contains additional fields (some metadata) i.e. version, manufacturer, date_added etc etc. which should be delivered to the user as well. Currently I've configured the API Gateway to proxy calls directly to my cloudsearch domain, so that users can query the product domain as they wish. But now I'm wondering if this is the proper way to do it, the user needs the full text search on the 3 fields described above, but once relevant records are found, the user also needs to get the product metadata. I'm currently not indexing the metadata fields in Cloudsearch and so I don't know what's the best way around it:

  1. Index all fields in cloudsearch and return everything from cloudsearch (seems inefficient to me)
  2. Index only the relevant fields in cloudsearch (id, description, name, tags), create a lambda that passes the query to cloudsearch, retrieves relevant records and then retrieves complete records from dynamodb by id

I'm really not sure what's the best way to go, thoughts?

0

There are 0 best solutions below