我打算用嵌套字段定義映射。根據該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