-
-
Save fabito/e0c1ab1d9d8ff8d1b5561884acd126ee to your computer and use it in GitHub Desktop.
sample elasticsearch query to sort parent based on child field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query":{ | |
"has_child":{ | |
"query":{ | |
"function_score":{ | |
"functions":[ | |
{ | |
"field_value_factor":{ | |
"factor":1, | |
"field":"count" | |
} | |
} | |
] | |
} | |
}, | |
"score_mode":"avg", | |
"type":"my_child_doc_type" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment