It depends on the kind of queries you want to do. Using an array of items loses the order of the items, however ( Complex Core Field Types | Elasticsearch: The Definitive Guide [2.x] | Elastic ). This means that queries are unable to distinguish the different levels in the hierarchy if you encode them by just splitting levels on "::". If you want to go with the array approach and keep hierarchy information you can use something like the path hierarchy tokenizer
( Path hierarchy tokenizer | Elasticsearch Guide [8.11] | Elastic ). It comes with limitations however if you want to do aggregations (see Elasticsearch - using the path hierarchy tokenizer to access different level of categories - Stack Overflow ). The most flexible solution for querying is probably if you use separate fields. This only makes sense though if your hierarchy does not have too many levels. Performance depends very much on the kind of aggregations done (Here, they are probably combined with some filters as well).