What is the best approach on hierarchical/nested data?

If I have an index of products and there are nested categories such as:

Men > Tops > Shirts

Should I store "Mens", "Mens>Tops", "Mens>Tops>Shirts" as separate categories and store them as an array:

product_categories : ["Mens", "Mens>Tops", "Mens>Tops>Shirts"] (or mapped ids)

Or should I store it as a nested data..something like:

product_category : {
level1: "Mens",
level2: "Tops",
level3: "Shirts"
}

Or is there another approach that is best?

You might be interested in the following section of the Elasticsearch:The Definitive Guide book for this: https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms-expand-or-contract.html#synonyms-genres