I'm using ElasticSearch as a data store and I'm wondering about how to structure my data. Coming from MySQL my natural instinct is to split everything into different types ("tables"), but I'm unsure if there is anything to be gained from it.
For example, I have an article with comments in it and I want to keep track of users who have clicked "like" on the comment. Should I simply keep the array of user ids in a nested array inside the comments of the article, or should I move the comments out into a separate comment type? And what about the array of users who have liked the comment, should that be a separate type as well?
{
"article": {
"properties": {
...
"comments": {
"properties": {
...
"likes": { "type": "string" } // array of UUIDs
}
}
}
Is there a problem with having nested arrays inside nested arrays from an efficiency perspective? And is it better to use nested arrays/objects or separate types when using ElasticSearch as a data store?