I have an ElasticSearch document mapping that is designed to support an n-level category tree, is there an alternate recommendation or best practice to accomplish n-level trees within a mapping structure? We are using the NEST client for building up our queries and to properly query and aggregate on this mapping is rather challenging and we haven't been able to dynamically build up the queries to search the entire tree.
Here's a json implementation of what our mapping looks like for the category tree
"productIndex": {
"mappings": {
"_doc": {
"properties": {
"productId": {
"type": "integer"
},
"category": {
"properties": {
"categoryId": {
"type": "integer"
},
"categoryName": {
"type": "text"
},
"childCategories": {
"categoryId": {
"type": "integer"
},
"categoryName": {
"type": "text"
}
}
}
}
}
}
}
}
Future use case for this product document mapping would be to allow for a product to be a part of multiple leaf nodes within the category tree.
Thanks!