Hi there,
I have some problem when i want to index (by using cURL) nested object , assume i have to indices (restaurant_info and restaurant_payment) both two indices have nested object. But problem that occured was nested object in restaurant_info can index to server without error. In contrast, nested object restaurant_payment can't index to server.
Here's restaurant_info mappings
{
"mappings": {
"fashion_brand_info": {
"properties": {
"restaurant_customer_review_details": {
"type": "nested",
"properties": {
"customer_id": {
"type": "keyword"
},
"customer_review": {
"type": "text"
},
"customer_score": {
"type": "double"
},
"customer_username": {
"type": "text"
}
}
}
}
}
}
}
Sample nested object (that can index without error)
{
"restaurant_customer_review_details": [
{
"customer_id": "CR101",
"customer_username": "Luke Skywalker",
"customer_review": "This is the greatest restaurant ever!",
"customer_score": 4
},
{
"customer_id": "CR102",
"customer_username": "Leia Organa",
"customer_review": "quite good",
"customer_score": 4
},
{
"customer_id": "CR103",
"customer_username": "Han Solo",
"customer_review": "really good",
"customer_score": 5
}
]
}
Here's restaurant_payment mappings (the problem index) { "mappings": { "restaurant_payment": { "properties": { "restaurant_credit_card_details": { "type": "nested", "properties": { "credit_card_bank": { "type": "keyword" }, "credit_card_condition": { "type": "text" }, "credit_card_privillage": { "type": "text" }, "credit_card_type": { "type": "keyword" } } } } } } }
Sample nested object (that always return error) it is contain in file "my_payment"
{ "restaurant_credit_card_details": [ { "credit_card_type": "VISA", "credit_card_bank": "ABC", "credit_card_condition": "Charge 3%", "credit_card_privillage": "none" }, { "credit_card_type": "VISA", "credit_card_bank": "DFG", "credit_card_condition": "Charge 3%", "credit_card_privillage": "get 100 point" } ] }
Here's the result when i indexed by cURL
curl -s -H "Content-Type: application/x-ndjson" -XPOST "http://localhost:9200/restaurant_payment/_bulk" --data-binary @D:\my_payment.json`
{
"took": 7,
"errors": true,
"items": [
{
"index": {
"_index": "restaurant_payment",
"_type": "payment",
"_id": "R001",
"status": 400,
"error": {
"type": "illegal_argument_exception",
"reason": "object mapping [restaurant_credit_card_details] can't be changed from nested to non-nested"
}
}
}
]
}
But when i indexed restaurant_payment by Kibana , It can index to server without error.
Now i confuse what's the problem, Is this a bug of cURL or my nested object structure are wrong.