I am currently trying to run a nativescript with the "script" property of
the river configuration. The script is starting as expected but the problem
is that doc() is always null and I can't access any fields of the document
to run my document transformation.
Any idea how to solve this?
public class LambertToWgs84Script extends AbstractSearchScript {
public static class Factory implements NativeScriptFactory {
@Override
public ExecutableScript newScript(@Nullable
Map<String, Object> params) {
return new LambertToWgs84Script(params);
}
}
@Override
public Object run() {
// Get xy Values
Long x = (Long) doc().get(
"realEstateCommonData.locationDto.geoCoordinateDto.xCoordinate");
Long y = (Long) doc().get(
"realEstateCommonData.locationDto.geoCoordinateDto.yCoordinate");
// Transformation
// Write Coordinates back
JSONObject newLocation = new JSONObject();
try {
newLocation.put("Type", "Point");
JSONArray coords = new JSONArray();
coords.put("bla");
coords.put("blub");
newLocation.put("coordinates", coords);
doc().put("location", newLocation);
} catch (JSONException e) {
e.printStackTrace();
}
return true;
}
}
--
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.
For more options, visit https://groups.google.com/groups/opt_out.