Skip to content

Instantly share code, notes, and snippets.

@morus12
Created November 4, 2013 12:30
Show Gist options
  • Save morus12/7301808 to your computer and use it in GitHub Desktop.
Save morus12/7301808 to your computer and use it in GitHub Desktop.
Timezone adjust
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
"user" : "kimchy",
"post_date" : "2013-10-05T14:12:12Z",
"message" : "trying out Elastic Search 1"
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/2' -d '{
"user" : "kimchy",
"post_date" : "2013-10-06T14:12:12Z",
"message" : "trying out Elastic Search 2"
}'
curl -XPUT 'http://localhost:9200/twitter/tweet/3' -d '{
"user" : "kimchy",
"post_date" : "2013-10-07T14:12:12Z",
"message" : "trying out Elastic Search 3"
}'
curl http://127.0.0.1:9200/twitter/_search -d '{
"facets": {
"tweets": {
"date_histogram": {
"field": "post_date",
"interval": "day",
"pre_zone": "Australia/Sydney",
"pre_zone_adjust_large_interval": true
}
}
},
"size": 0
}'
{
"took":2,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"failed":0
},
"hits":{
"total":3,
"max_score":1.0,
"hits":[
]
},
"facets":{
"tweets":{
"_type":"date_histogram",
"entries":[
{
"time":1380978000000,
"count":1
},
{
"time":1381064400000,
"count":1
},
{
"time":1381150800000,
"count":1
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment