I'm trying to set up AWS' Cloudsearch with a DynamoDB table. My data structure is something like this:
{
"name": "John Smith",
"phone": "0123 456 789"
"business": {
"name": "Johnny's Cool Co",
"id": "12345",
"type": "contractor",
"suburb": "Sydney"
},
"profession": {
"name": "Plumber",
"id": "20"
},
"email": "johnsmith@gmail.com",
"id": "354684354-4b32-53e3-8949846-211384",
}
Importing this data from DynamoDB -> Cloudsearch is a breeze, however I want to be able to index on some of these nested object parameters (like business.name
, profession.name
etc).
Cloudsearch is pulling in some of the nested objects like suburb
, but it seems like it's impossible for it to differentiate between the name
in the root of the object and the name
within the business
and profession
objects.
Questions:
- How do I make these nested parameters searchable? Can I index on
business.name
or something? - If #1 is not possible, can I somehow send my data through a transforming function before it gets to Cloudsearch? This way I could flatten all of my objects and give the fields unique names like
businessName
andprofessionName
EDIT:
My solution at the moment is to have a separate DynamoDB table which replicates our users
table, but stores it in a CloudSearch-friendly format. However, I don't like this solution at all so any other ideas are totally welcome!