Я пытаюсь проиндексировать документ в Elasticsearch 6.2. С dynamic mapping
все работает как положено. Есть два вложенных объекта menu
и address
. Когда я пытаюсь проиндексировать документ, появляются следующие ошибки.
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "object mapping [menu] can't be changed from nested to non-nested"
}
],
"type": "illegal_argument_exception",
"reason": "object mapping [menu] can't be changed from nested to non-nested"
},
"status": 400
}
http://localhost:9200/index_name/type_name/1
Детали отображения:
{
"settings": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 10
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
"mappings": {
"type_name": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "text",
"analyzer": "autocomplete"
},
"description": {
"type": "text"
},
"phone_number": {
"type": "text"
},
"cuisine": {
"type": "text",
"analyzer": "autocomplete"
},
"eat": {
"type": "text",
"analyzer": "autocomplete"
},
"rating": {
"type": "float"
},
"address": {
"type": "nested",
"properties": {
"city": {
"type": "text",
"analyzer": "autocomplete"
},
"area": {
"type": "text",
"analyzer": "autocomplete"
},
"pincode": {
"type": "keyword",
"index": "false"
},
"coordinate": {
"type": "geo_point"
},
"full_address": {
"type": "text"
}
}
},
"menu": {
"type": "nested",
"properties": {
"id": {
"type": "integer"
},
"dish_name": {
"type": "text",
"analyzer": "autocomplete"
},
"category": {
"type": "text"
},
"price": {
"type": "float"
}
}
}
}
}
}
}
Подробности документа:
{
"id" : 1,
"name" : "Nagarjuna ",
"description" : "The Description",
"phone_number" : ["835555558"],
"address" : [{
"city" : "Bangalore",
"area" : "Marathahalli",
"pincode" : "560030",
"full_address" : "88, Outer Ring Road, Next to MORE MEGA Store, Marathahalli, Bangalore",
"coordinate" : "12.973157, 77.608940"
}],
"rating" : "4",
"eat" : "Non Veg",
"menu" : [
{
"id" : 1,
"category" : "Dosa",
"dish_name" : "Plain Dosa",
"price" : 130
},
{
"id" : 2,
"category" : "Dosa",
"dish_name" : "Onion Dosa",
"price" : 150
},
{
"id" : 3,
"category" : "Dosa",
"dish_name" : "Set Dosa",
"price" : 150
},
{
"id" : 4,
"category" : "Dosa",
"dish_name" : "Rava Dosa",
"price" : 180
},
{
"id" : 5,
"category" : "Dosa",
"dish_name" : "Masala Dosa",
"price" : 150
},
{
"id" : 6,
"category" : "Briyani",
"dish_name" : "Chicken Briyani",
"price": 250
},
{
"id" : 7,
"category" : "Briyani",
"dish_name" : "Muton Briyani",
"price": 280
}
]
}
Отладка с долгого времени, но тщетно. Пожалуйста, помогите.