Group by date aggregation on day by day?

{
"size": 0,
"aggs" : {
"group_by_day" : {
"date_histogram" : {
"field" : "date_inserted",
"interval": "day"
}
}
}
}

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
}

The mapping seems incorrect.

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
}

can you please assist me what is wrong

Please format your code, logs or configuration files using </> icon as explained in this guide 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:

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.

You need to reindex.

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