lundi 4 mai 2015

How do I denormalize my relational data for AWS CloudSearch documents?

AWS CloudSearch expects you will send them flattened documents of your data to index for search which look something like:

[
 {"type": "add",
  "id":   "123456",
  "fields": {
     "account_id": "123456",
     "name": "foo",
     "addresses": []
  }
 }
]

Let's assume I have a database with an accounts table and an addresses table.

There are many addresses for each account. The addresses table has the fields:

  • address_1
  • address_2
  • city
  • state
  • zip
  • account_id (reference field)

How would I denormalize addresses in the CloudSearch document structure so that I can search across all of the columns in accounts and addresses?

Or should I be creating a separate search domain for each table?




Aucun commentaire:

Enregistrer un commentaire