Runtime field field conversion problem,

followup on

I found one other thing, .

when the data is long

""longitude":-99.628611894415343,"latitude":37.463502579397019

the painless script has trouble figuring out what data type it is..

              "script_stack": [
                "emit(doc['addressinfo.latitude'].value, doc['addressinfo.longitude'].value)}",
                "                                ^---- HERE"
              ],
              "script": "if(doc.containsKey('addressinfo.latitude')){emit(doc['addressinfo.latitude'].value, doc['addressinfo.longitude'].value)}",
              "lang": "painless",
              "position": {
                "offset": 76,
                "start": 44,
                "end": 120
              },
              "caused_by": {
                "type": "wrong_method_type_exception",
                "reason": "cannot convert MethodHandle(Strings)String to (Object)double"
              }

if you change it to explicitly parse, then it works ok..

"source":
                "if(doc.containsKey('addressinfo.latitude')){emit(Float.parseFloat(doc['addressinfo.latitude'].value), Float.parseFloat(doc['addressinfo.longitude'].value))}"
            }

but.. one shouldn't have to do that.. just because the decimal is a long string....

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