Sorting on nested field with conditon


I have the following document:

"mappings" : {
"notations": {
"type": "nested"

In "notations", I have elements like:



Is it possible to sort with field notations.grade with the following condition:

if (exist notation.key=="custom") take the corresponding notation.grade
else if (exist notation.key=="default") take the corresponding notation.grade


I saw the documentation describing nested sorting examples here:

but it does not tell if we can add an "else if" condition.

Is there another way to implement that behavior?



This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.