I have the following type in elasticsearch
"hotel" : {
"magicScore" : 1
"rooms" : [
{
"type" : "single",
"magicScore" : 1
},
{
"type" : "double",
"magicScore" : 2
}
]
}
where rooms is of type nested. I would like to sort using a scripted sort, for example
"sort" : [ {
"_script" : {
"script" : "return doc['magicScore'].value + doc['rooms.magicScore'].value",
"params" : ,
"type" : "number",
"reverse" : true
}
} ]
This does not work because rooms are nested objects, is there a way around this?