Created
February 29, 2016 03:36
-
-
Save robinloxley1/7ea7c4f37a3413b1ca16 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
Heyy,How can we write this query in Java API Spring data elasticsearch using QueryBuilder.