# ClassCastException with histogram in Kibana

**URL:** <https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705>\
**Category:** Elasticsearch\
**Created:** [September 20, 2013, 3:06pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705 "2013-09-20T15:06:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Kincaid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_kincaid/32/2181_2.png) [@David\_Kincaid](https://discuss.elastic.co/u/David_Kincaid)\
**Post date:** [September 20, 2013, 3:06pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/1 "2013-09-20T15:06:09Z")

</div>

I'm getting the following error when trying to add a histogram panel to a  
Kibana dashboard. Could someone help me interpret what the problem might be?

ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData  
cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [September 21, 2013, 4:49pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/2 "2013-09-21T16:49:50Z")

</div>

Well, at a high level, PagedBytesIndexFieldData is a data structure that  
holds strings in memory, while IndexNumericFieldData is for numeric values.  
So it appears that something is trying to use string field data for a  
numeric operation.

Can you provide the mapping of your index, and the histogram that you are  
trying to create (on what fields)? What version of Elasticsearch are you  
using?

-Zach

On Friday, September 20, 2013 11:06:09 AM UTC-4, David Kincaid wrote:

> I'm getting the following error when trying to add a histogram panel to a  
> Kibana dashboard. Could someone help me interpret what the problem might be?
> 
> ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData  
> cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![David\_Kincaid](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_kincaid/32/2181_2.png) [@David\_Kincaid](https://discuss.elastic.co/u/David_Kincaid)\
**Post date:** [September 21, 2013, 6:51pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/3 "2013-09-21T18:51:59Z")

</div>

Thanks for the info. As soon as I looked at the mapping to send it to the  
list I saw the problem. The field that I was trying to create the histogram  
on is supposed to be a date, but it is actually a string. Thanks for  
pointing me in the right direction.

Dave

On Saturday, September 21, 2013 12:49:50 PM UTC-4, Zachary Tong wrote:

> Well, at a high level, PagedBytesIndexFieldData is a data structure that  
> holds strings in memory, while IndexNumericFieldData is for numeric values.  
> So it appears that something is trying to use string field data for a  
> numeric operation.
> 
> Can you provide the mapping of your index, and the histogram that you are  
> trying to create (on what fields)? What version of Elasticsearch are you  
> using?
> 
> -Zach
> 
> On Friday, September 20, 2013 11:06:09 AM UTC-4, David Kincaid wrote:
> 
> > I'm getting the following error when trying to add a histogram panel to a  
> > Kibana dashboard. Could someone help me interpret what the problem might be?
> > 
> > ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData  
> > cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [September 21, 2013, 6:59pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/4 "2013-09-21T18:59:07Z")

</div>

Awesome, glad you sorted out the problem =)

-Zach

On Sat, Sep 21, 2013 at 2:51 PM, David Kincaid [kincaid.dave@gmail.com](mailto:kincaid.dave@gmail.com)wrote:

> Thanks for the info. As soon as I looked at the mapping to send it to the  
> list I saw the problem. The field that I was trying to create the histogram  
> on is supposed to be a date, but it is actually a string. Thanks for  
> pointing me in the right direction.
> 
> Dave
> 
> On Saturday, September 21, 2013 12:49:50 PM UTC-4, Zachary Tong wrote:
> 
> > Well, at a high level, PagedBytesIndexFieldData is a data structure that  
> > holds strings in memory, while IndexNumericFieldData is for numeric values.  
> > So it appears that something is trying to use string field data for a  
> > numeric operation.
> > 
> > Can you provide the mapping of your index, and the histogram that you are  
> > trying to create (on what fields)? What version of Elasticsearch are you  
> > using?
> > 
> > -Zach
> > 
> > On Friday, September 20, 2013 11:06:09 AM UTC-4, David Kincaid wrote:
> > 
> > > I'm getting the following error when trying to add a histogram panel to  
> > > a Kibana dashboard. Could someone help me interpret what the problem might  
> > > be?
> > > 
> > > ClassCastException[org.\*\*elasticsearch.index.fielddata.\*\*plain.PagedBytesIndexFieldData  
> > > cannot be cast to org.elasticsearch.index. **fielddata.**  
> > > IndexNumericFieldData
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Ow\_9yVdihmg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ow_9yVdihmg/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 22, 2013, 4:58pm UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/5 "2013-09-22T16:58:41Z")

</div>

Hey,

can you provide us with some more information (or even issue a bug report),  
when this happens (providing mapping and your query should be sufficient).  
It makes more sense to return a valid error value (like "Dont use a string  
field, numeric needed") to the user instead of some weird class cast  
exception 🙂

Thanks!

--Alex

On Sat, Sep 21, 2013 at 8:51 PM, David Kincaid [kincaid.dave@gmail.com](mailto:kincaid.dave@gmail.com)wrote:

> Thanks for the info. As soon as I looked at the mapping to send it to the  
> list I saw the problem. The field that I was trying to create the histogram  
> on is supposed to be a date, but it is actually a string. Thanks for  
> pointing me in the right direction.
> 
> Dave
> 
> On Saturday, September 21, 2013 12:49:50 PM UTC-4, Zachary Tong wrote:
> 
> > Well, at a high level, PagedBytesIndexFieldData is a data structure that  
> > holds strings in memory, while IndexNumericFieldData is for numeric values.  
> > So it appears that something is trying to use string field data for a  
> > numeric operation.
> > 
> > Can you provide the mapping of your index, and the histogram that you are  
> > trying to create (on what fields)? What version of Elasticsearch are you  
> > using?
> > 
> > -Zach
> > 
> > On Friday, September 20, 2013 11:06:09 AM UTC-4, David Kincaid wrote:
> > 
> > > I'm getting the following error when trying to add a histogram panel to  
> > > a Kibana dashboard. Could someone help me interpret what the problem might  
> > > be?
> > > 
> > > ClassCastException[org.\*\*elasticsearch.index.fielddata.\*\*plain.PagedBytesIndexFieldData  
> > > cannot be cast to org.elasticsearch.index. **fielddata.**  
> > > IndexNumericFieldData
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:15am UTC](https://discuss.elastic.co/t/classcastexception-with-histogram-in-kibana/13705/6 "2017-07-06T02:15:12Z")

</div>


