我打算用嵌套字段定义映射。根据该documentation,有效载荷/order-statistics/_mapping/order
样子:elasticsearch:如何用嵌套字段定义映射?
{
"mappings" : {
"order": {
"properties" : {
"order_no" : {
"type" : "string"
},
"order_products" : {
"type" : "nested",
"properties" : {
"order_product_no" : {
"type" : "int"
},
"order_product_options" : {
"type" : "nested",
"properties" : {
"order_product_option_no" : {
"type" : "int"
}
}
}
}
}
}
}
}
}
我已经创建了order-statistics
指数与调用curl -XPUT 'localhost:9200/order-statistics'
,我使用预定义的类型,如int
,string
,double
,但我得到的出现以下错误并无法找到问题所在。
{
"error":{
"root_cause":[
{
"type":"mapper_parsing_exception",
"reason":"Root mapping definition has unsupported parameters: [mappings : {order={properties={order_no={type=string}, order_products={type=nested, properties={order_product_no={type=int}, order_product_options={type=nested, properties={order_product_option_no={type=int}}}}}}}}]"
}
],
"type":"mapper_parsing_exception",
"reason":"Root mapping definition has unsupported parameters: [mappings : {order={properties={order_no={type=string}, order_products={type=nested, properties={order_product_no={type=int}, order_product_options={type=nested, properties={order_product_option_no={type=int}}}}}}}}]"
},
"status":400
}
有人可以解释为什么这不起作用吗?
你使用哪个版本,字符串在最新版本中被弃用,“int”应该是“整数”。 – MartinSchulze