How to figure out field type?

I've added some data to my ES.

JSON format:

"site" : "",
"name" : "amount-active-users",

"daily" : {
"dataX": [1,2,3],
"dataY": [1388538061, 1388624461, 1388710861],


If you look at dataX field, it's an array. ES interprets it as an array on

Now when I add another JSON doc with dataX being doubles I'm not sure on
the Java side how to know when the input is in format
criptDocValues.Doubles or criptDocValues.Longs
I would like data to be interpreted as doubles all the time.

This is the terrible code I use to case but it's not working after adding
the doubles to the dataX field:

List dataXTimeSeries2Long= ((ScriptDocValues.Doubles)
List dataXTimeSeries2 = new ArrayList();
//reverse TS so that it matches order of series retrieved via
client() - ya those are reversed
for(int i=dataXTimeSeries2Long.size()-1; i>-1; i--){

//using toStr is slow

This code fails with a class cast exception:
cannot be cast to
org.elasticsearch.index.fielddata.ScriptDocValues$Doubles]; }]
I can do that in Scala. Java is behind.


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
To view this discussion on the web visit
For more options, visit