"customer": {
"id": 2,
"user_profile": {
"rating": 0.16,
"name": "Сергей",
"surname": "Петров",
"reviewsCount": 1
}
},
Вот такая вложенная структура.
Поисковый запрос такой.
GET mytasks/mytask/_search
{ "query": { "match_all": {} },
"sort" : [
"_score",
{
"customer.user_profile.rating" : {
"order" : "desc",
"nested_path" : "customer.user_profile"
}
},
{"createdAt": {"order": "desc"}}
]
}
Получаю ошибку.
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "[nested] nested object under path [customer.user_profile] is not of nested type",
"index_uuid": "pLlOA9jMTpa10DwJMWacrg",
"index": "mytasks"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "mytasks",
"node": "O0XJacQYR_SX-EKIeFk-MA",
"reason": {
"type": "query_shard_exception",
"reason": "[nested] nested object under path [customer.user_profile] is not of nested type",
"index_uuid": "pLlOA9jMTpa10DwJMWacrg",
"index": "mytasks"
}
}
]
},
"status": 400
}
Может можно сортировать только, когда один уровень вложенности?
А у меня получается двойной уровень вложенности.
Мэппинго определен сейчас так:
{
"mappings": {
"mytask": {
"properties": {
"customer": {
"type": "nested"
}
}
}
}
}