I am probably like many people that have more of a SQL background, and am attempting to branch out into using Elasticsearch. I am attempting to make a design choice that I'm hoping I can get some input on. We have a product database of around 50K SKU's (with a need to scale). We are a B2B wholesaler, so pricing varies by customer and by branch. From what I understand, nested documents have potential performance issues, so I'm considering if it would be better to flatten it and use the key to make the pricing unique? For example, I can do the following structure:
product : {
"...",
"...",
"...",
"attributes": {
"price_<customer id>_<branch>": <price>
}
}
Would that likely be better than using nested documents to maintain the unique pricing for each customer/branch? It will always be a 1 to 1 mapping. Pricing doesn't change a ton, but it would need a periodic update as price changes come in.