# Need help: histogram & time zone

**URL:** <https://discuss.elastic.co/t/need-help-histogram-time-zone/141378>\
**Category:** Elasticsearch\
**Created:** [July 24, 2018, 12:20pm UTC](https://discuss.elastic.co/t/need-help-histogram-time-zone/141378 "2018-07-24T12:20:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kklingjie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kklingjie/32/33705_2.png) [@kklingjie](https://discuss.elastic.co/u/kklingjie)\
**Post date:** [July 24, 2018, 12:20pm UTC](https://discuss.elastic.co/t/need-help-histogram-time-zone/141378/1 "2018-07-24T12:20:15Z")

</div>

## Data source:

```
"hits": [{
"_index": "log",
"_type": "accesslog",
"_id": "5b2977e843644c8a7e8b4582",
"_score": 1,
"_source": {
	"id": {
		"$id": "5b2977e843644c8a7e8b4582"
	},
	"ip": "117.30.209.86",
	"source_url": "www",
	"ctime": "2018-06-20 05:38:48",
	"ctimeint": 1529444328,
	"pagemarks": "PC",
	"user_id": 1021001,
	"url": "id=101119055",
	"user_agent": "Microsoft Internet Explorer"
}

```

}, ]

## ES query Code:

```
GET / log / accesslog / _search {
"size": 0,
"query": {
	"filtered": {
		"query": {
			"bool": {
				"must": [{
					"range": {
						"ctimeint": {
							"gte": 1532016000,
							"lt": 1532275200
						}
					}
				}]
			}
		}
	}
},
"aggs": {
	"time": {
		"histogram": {
			"field": "ctimeint",
			"interval": 86400
		},
		"aggs": {
			"mark": {
				"terms": {
					"field": "pagemarks",
					"size": 0,
					"collect_mode": "breadth_first"
				},
				"aggs": {
					"ip": {
						"cardinality": {
							"field": "ip"
						}
					}
				}
			}
		}
	}
}
}

```

## Result：

```
"aggregations": {
"time": {
	"buckets": [{
		"key": 1531958400,
		"doc_count": 1266094,
		"mark": {
			"doc_count_error_upper_bound": 0,
			"sum_other_doc_count": 0,
			"buckets": [{
				"key": "groupbuydetail",
				"doc_count": 89115,
				"ip": {
					"value": 3494
				}
			}, ]
		}
	}]
}

```

## Question：

I would like to query the agg histogram data **between 2018/7/20 and 2018/7/23** (time zone: Asia/Shanghai); But the time for aggregation statistics is **2018/7/19 08:00:00**

the key :  
query-\>range: **1532016000** (2018/7/20) ~ **1532275200** (2018/7/23)  
agg-\>buckets: **1531958400** (2018/7/19 08:00:00)

1, Data Source: hits-\>ctime time zone is **Asia/Shanghai**

2, my elasticsearch version is **1.7.3**

3, my linux(centos) date like : **Tue Jul 24 18:21:06 CST 2018** ;

Excuse me, big cow  
I know data\_histogram using time\_zone，but about histogram  
How to make the aggregation statistics time like: 2018/7/20 2018/7/21 2018/7/22... ?

Waiting online! 3Q 3Q 3Q!

Sorry, I can't find the problem of elasticsearch version 1.7.3

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2018, 12:20pm UTC](https://discuss.elastic.co/t/need-help-histogram-time-zone/141378/2 "2018-08-21T12:20:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
