How to integrate tables to one document

I have three tables as RDS, each refers to products, categories and genres
The relation is that a product has many genres and a category has many genres and foreign keys tie them up.

I want to make it possible to search them by product name, genres and categories.
Could you show me the best practice to integrate them into documents.

Our usual recommendation is to flatten your data. So flatten everything down to a single record that has the genre and category inlined...

{
  "product": "1",
  "genre": ["comedy", "romance"],
  "category" ["entertainment"]
},
{
  "product": "2",
  "genre": ["comedy"],
  "category" ["entertainment", "sports"]
}