# Kibana elasticsearch query question

**URL:** <https://discuss.elastic.co/t/kibana-elasticsearch-query-question/19946>\
**Category:** Elasticsearch\
**Created:** [September 24, 2014, 2:26pm UTC](https://discuss.elastic.co/t/kibana-elasticsearch-query-question/19946 "2014-09-24T14:26:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rhys\_Campbell](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rhys\_Campbell](https://discuss.elastic.co/u/Rhys_Campbell)\
**Post date:** [September 24, 2014, 2:26pm UTC](https://discuss.elastic.co/t/kibana-elasticsearch-query-question/19946/1 "2014-09-24T14:26:16Z")

</div>

Hi All,

I've been trying to graph data obtains from a "SHOW STATUS" mysql query.  
When attempting to graph "Threads\_connected" using Kibana is received the  
following error...

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

I checked my mappings and the "Value" field has been added to elasticsearch  
as a string even though it only ever contains integer counts. I don;t  
really want to re-dump my data and change mappings so I've managed to fix  
the query using dynamic scripting like so...

curl -XGET '[http://hostname:9200/\_all/\_search?pretty](http://hostname:9200/_all/_search?pretty)' -d '{  
"facets": {  
"0": {  
"date\_histogram": {  
"key\_field": "@timestamp",  
"value": "doc['Value'].Intvalue",  
"interval": "5m"  
},  
"global": true,  
"facet\_filter": {  
"fquery": {  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "source:mysql\_status AND  
Variable\_name:Threads\_connected"  
}  
},  
"filter": {  
"bool": {  
"must": [  
{  
"range": {  
"@timestamp": {  
"from": 1411520355984,  
"to": 1411563555984  
}  
}  
}  
]  
}  
}  
}  
}  
}  
}  
}  
},  
"size": 0

I have simply changed..

"value": "Value",

to...

"value": "doc['Value'].Intvalue",

This query returns what I want but I am unable to get this into Kibana  
without it throwing some kind of error. So my question would be... how do I  
get my historgram to use data from the above query?

Rhys

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2bec5082-40a1-4384-b80b-46fce8920cdb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2bec5082-40a1-4384-b80b-46fce8920cdb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:00am UTC](https://discuss.elastic.co/t/kibana-elasticsearch-query-question/19946/2 "2017-07-06T01:00:11Z")

</div>


