I have 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' },
}
}
}
}
Document look like this:
{
'name': 'Kindle',
'shops': [
{ 'name': 'amazon', 'url': 'http://...', 'price': 79 },
{ 'name': 'ebay', 'url': 'http://...', 'price': 99 }
}
But I want store documents in this format:
{
'name': 'Kindle',
'shops': {
'amazon': { 'url': 'http://...', 'price': 79 },
'ebay': { 'url': 'http://...', 'price': 99 }
}
}
Is there any way to do mapping for this? Or I should create only object 'shops' and keep it schema-less.