I have a simple document with this mapping:
'product': {
'properties': {
'name': { 'type': 'string' },
'shops': {
'type': 'object',
'index_name': 'shop',
'properties': {
'name': { 'type': 'string' },
'url': { 'type': 'string' },
'price': { 'type': 'integer' },
}
}
}
}
The document is as follows:
{
'name': 'Kindle',
'shops': [
{ 'name': 'amazon', 'url': 'http://...', 'price': 79 },
{ 'name': 'ebay', 'url': 'http://...', 'price': 99 }
}
But I want to store documents in this format:
{
'name': 'Kindle',
'shops': {
'amazon': { 'url': 'http://...', 'price': 79 },
'ebay': { 'url': 'http://...', 'price': 99 }
}
}
Is there a way to do a mapping for this? Or I have to create only objects "stores" and save them without a diagram.
source
share