I've added some data to my ES.
JSON format:
{
"doc":{
"site" : "marriage.com",
"name" : "amount-active-users",
"daily" : {
"dataX": [1,2,3],
"dataY": [1388538061, 1388624461, 1388710861],
"startDate":1388538061,
"endDate":1388710861
}
}
}
If you look at dataX field, it's an array. ES interprets it as an array on
Longs.
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)
doc().get(rootPathDataX)).getValues();
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--){
dataXTimeSeries2.add(Double.parseDouble(dataXTimeSeries2Long.get(i).toString()));
//using toStr is slow
}
This code fails with a class cast exception:
ClassCastException[org.elasticsearch.index.fielddata.ScriptDocValues$Longs
cannot be cast to
org.elasticsearch.index.fielddata.ScriptDocValues$Doubles]; }]
I can do that in Scala. Java is behind.
Help!
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/12d62f00-b0c5-4552-b4fe-07a874085ce4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.