I have an index that has nested objects. The objects have "id" and "rank" properties. I'd like to sort the main objects (the parents, I guess) by the sum of the "rank" of ONLY the matching nested objects. So if I have something tagged "angry", "rock" and "metal," but I search "angry rock," I only want to sum "angry" and "rock" ranks, I want to ignore the "metal" tag's rank.
Mapping:
{
"mappings" : {
"songs" : {
"properties" : {
"tags" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "integer"
},
"likeness_rank" : {
"type" : "integer"
}
}
}
}
}
}
}
So if I search "angry rock", and a few songs were tagged with "angry" and "rock", but one song had a lower combined rank of those two tags (meaning it has other tags ranked above those), it would be lower on the list than a song whose highest ranked tags are "angry" and "rock".
How would I do this?