Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save karmi/1242193 to your computer and use it in GitHub Desktop.
Save karmi/1242193 to your computer and use it in GitHub Desktop.
curl -X GET 'http://localhost:9200/articles/_search?search_type=count&pretty=true' -d \
'{
"query" : {
"match_all" : {}
},
"facets" : {
"by_hour" : {
"range" : {
"key_script" : "doc[\"published_on\"].date.hourOfDay",
"value_script" : "1",
"ranges" : [
{ "from" : 0, "to" : 1 },
{ "from" : 1, "to" : 2 },
{ "from" : 2, "to" : 3 },
{ "from" : 3, "to" : 4 },
{ "from" : 4, "to" : 5 },
{ "from" : 5, "to" : 6 },
{ "from" : 7, "to" : 8 },
{ "from" : 8, "to" : 9 },
{ "from" : 9, "to" : 10 },
{ "from" : 10, "to" : 11 },
{ "from" : 11, "to" : 12 },
{ "from" : 12, "to" : 13 },
{ "from" : 13, "to" : 14 },
{ "from" : 14, "to" : 15 },
{ "from" : 15, "to" : 16 },
{ "from" : 16, "to" : 17 },
{ "from" : 17, "to" : 18 },
{ "from" : 18, "to" : 19 },
{ "from" : 19, "to" : 20 },
{ "from" : 20, "to" : 21 },
{ "from" : 21, "to" : 22 },
{ "from" : 22, "to" : 23 },
{ "from" : 23 }
]
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment