Я создаю отображение для данных, сгенерированных приложением компьютерного зрения. Тем не менее, я получаю сообщение об ошибке при тестировании отправки примера сообщения данных в ElasticSearch. Я прочитал тонны форумов, где другие имели эту проблему. Некоторые решили их проблему, но я попробовал все, что знаю, чтобы попробовать. Я действительно думаю, что может быть простое решение, но я относительно новичок в Elasti c Search.
Индекс и сопоставление успешно созданы с использованием:
PUT vision_events
{
"settings" : {
"number_of_shards" : 5
},
"mappings" : {
"properties": {
"camera_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"hit_counts": {
"type": "long"
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"intersection": {
"type": "boolean"
},
"label": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"locations": {
"type" : "nested",
"properties": {
"coords" : {
"type" : "float"
},
"location": {
"type": "text"
},
"street_segment": {
"type": "text"
},
"timestamp": {
"type": "date"
}
}
},
"pole_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"timestamp": {
"type": "date"
}
}
}
}
После завершения я перехожу к проверке правильности сопоставления. I pu sh следующие примеры данных:
POST /vision_events/1?pretty=true
{
"pole_id": "mlk-central-2",
"camera_id": "mlk-central-cam-2",
"intersection": true,
"id": "644d1c06-4c60-4ed8-93b4-1aa79b87a622",
"label": "car",
"timestamp": 1586838108683,
"locations": [
{
"timestamp": 1586838109448,
"coords": 1626.3220383482665,
"street_segment": "None"
},
{
"timestamp": 1586838109832,
"coords": 1623.3129222859882,
"street_segment": "None"
}
],
"hit_counts": 2
}
Это приводит к следующей ошибке:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "object mapping [locations] can't be changed from nested to non-nested"
}
],
"type" : "illegal_argument_exception",
"reason" : "object mapping [locations] can't be changed from nested to non-nested"
},
"status" : 400
}
Поле location представляет собой список «объектов», которые содержат поля :ordins , местоположение, street_segment и метка времени. Сообщения имеют различную длину местоположений. Любая помощь будет принята с благодарностью.