# Group by date aggregation on day by day?

**URL:** https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703
**Category:** Elasticsearch
**Created:** [May 1, 2020, 11:13am UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703 "2020-05-01T11:13:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)
#### Post date: [May 1, 2020, 11:13am UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/1 "2020-05-01T11:13:41Z")

</div>

{  
"size": 0,  
"aggs" : {  
"group\_by\_day" : {  
"date\_histogram" : {  
"field" : "date\_inserted",  
"interval": "day"  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)
#### Post date: [May 1, 2020, 11:16am UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/3 "2020-05-01T11:16:41Z")

</div>

Getting illegal argument exception

{  
"error": {  
"root\_cause": [  
{  
"type": "illegal\_argument\_exception",  
"reason": "Expected numeric type on field [date\_inserted], but got [text]"  
}  
],  
"type": "search\_phase\_execution\_exception",  
"reason": "all shards failed",  
"phase": "query",  
"grouped": true,  
"failed\_shards": [  
{  
"shard": 0,  
"index": "webtvasia\_dash\_channel\_list",  
"node": "\_a1yPXtmRcGiiX7M3xzlpg",  
"reason": {  
"type": "illegal\_argument\_exception",  
"reason": "Expected numeric type on field [date\_inserted], but got [text]"  
}  
}  
],  
"caused\_by": {  
"type": "illegal\_argument\_exception",  
"reason": "Expected numeric type on field [date\_inserted], but got [text]",  
"caused\_by": {  
"type": "illegal\_argument\_exception",  
"reason": "Expected numeric type on field [date\_inserted], but got [text]"  
}  
}  
},  
"status": 400  
}

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 1, 2020, 12:51pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/4 "2020-05-01T12:51:23Z")

</div>

The mapping seems incorrect.

---

<div class="post-metadata">

### Author: ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)
#### Post date: [May 1, 2020, 12:54pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/5 "2020-05-01T12:54:39Z")

</div>

I tried to convert the mapping but i con't able to convert

{  
"error": {  
"root\_cause": [  
{  
"type": "illegal\_argument\_exception",  
"reason": "mapper [date\_inserted] of different type, current\_type [text], merged\_type [integer]"  
}  
],  
"type": "illegal\_argument\_exception",  
"reason": "mapper [date\_inserted] of different type, current\_type [text], merged\_type [integer]"  
},  
"status": 400  
}

---

<div class="post-metadata">

### Author: ![Ramesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramesh_kumar/32/66841_2.png) [@Ramesh\_Kumar](https://discuss.elastic.co/u/Ramesh_Kumar)
#### Post date: [May 1, 2020, 12:55pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/6 "2020-05-01T12:55:15Z")

</div>

can you please assist me what is wrong

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 1, 2020, 6:57pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/7 "2020-05-01T18:57:03Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 1, 2020, 6:57pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/8 "2020-05-01T18:57:19Z")

</div>

You need to reindex.

---

<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: [May 29, 2020, 7:02pm UTC](https://discuss.elastic.co/t/group-by-date-aggregation-on-day-by-day/230703/9 "2020-05-29T19:02:00Z")

</div>

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