So far I followed this guide to get native java scripts working with elasticsearch. Accessing normal non-nested fields works fine using doc().field("fieldname").
Does the same work for nested fields? How can I loop over them and access nested fields?
EDIT: After reading imotov's answer below I ended up including the nested field in the root document using include_in_root or include_in_parent (See docs).
GeoPoint[] locations = ((GeoPointDocFieldData)doc().field("places.location")).getValues();
for (GeoPoint location : locations) {
// Do Stuff
double lat = location.lat();
double lon = location.lon();
}