我有这个映射的简单文档:
'product': {
'properties': {
'name': { 'type': 'string' },
'shops': {
'type': 'object',
'index_name': 'shop',
'properties': {
'name': { 'type': 'string' },
'url': { 'type': 'string' },
'price': { 'type': 'integer' },
}
}
}
}文档看起来像这样:
{
'name': 'Kindle',
'shops': [
{ 'name': 'amazon', 'url': 'http://...', 'price': 79 },
{ 'name': 'ebay', 'url': 'http://...', 'price': 99 }
}但我希望存储文档采用以下格式:
{
'name': 'Kindle',
'shops': {
'amazon': { 'url': 'http://...', 'price': 79 },
'ebay': { 'url': 'http://...', 'price': 99 }
}
}有没有办法对此进行映射?或者,我应该只创建对象‘shop’,并保持它的无模式。
发布于 2012-04-13 02:42:55
您可以使用带有path_match的dynamic_template ("shops.*") 1。
https://stackoverflow.com/questions/10127971
复制相似问题