Last active
December 23, 2015 04:39
-
-
Save fabien7337/6581373 to your computer and use it in GitHub Desktop.
Multiple value in a terms stats
This file contains 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
curl -X GET '127.0.0.1:9200/octoly-development-videos/video/_search?from=0&size=20&pretty' -d '{ | |
"query":{ | |
"bool":{ | |
"must":[ | |
{ | |
"query_string":{ | |
"query":"*", | |
"default_operator":"AND" | |
} | |
} | |
], | |
"should":[ | |
{ | |
"bool":{} | |
} | |
], | |
"minimum_should_match":1 | |
} | |
}, | |
"sort":[ | |
{ | |
"views_count":"desc" | |
} | |
], | |
"facets":{ | |
"views_count":{ | |
"statistical":{ | |
"field":"views_count" | |
} | |
}, | |
"comments_count":{ | |
"statistical":{ | |
"field":"comments_count" | |
} | |
}, | |
"likes_count":{ | |
"statistical":{ | |
"field":"likes_count" | |
} | |
}, | |
"dislikes_count":{ | |
"statistical":{ | |
"field":"dislikes_count" | |
} | |
}, | |
"advanced_stats":{ | |
"terms_stats":{ | |
"key_field":"brand_ids", | |
"value_script": doc['views_count'].value + doc['likes_count'].value + doc['dislikes_count'].value, | |
"size":5 | |
} | |
} | |
}, | |
"size":20, | |
"from":0 | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment