// Define tag array ArrayList tags = ctx._source.tag = new ArrayList(); // Display camera model in pale green if (ctx._source?.exif_model != null) { tags.add("Model." + ctx._source.exif_model + "#6F9F9C"); } // Display focal length in pale yellow if (ctx._source?.exif_focal_length != null) { String[] values = ctx._source.exif_focal_length.splitOnToken('.'); String focal = values[0]; focal = focal.replace(".", ","); if (focal == "NaN") { focal = "0,0"; } tags.add("Focal." + focal + "mm#F7DC6F"); } // Display shutter speed in pale red if (ctx._source?.exif_exposure_time != null) { tags.add("Shutter." + ctx._source.exif_exposure_time + "s#D98880"); } // Display f-stop in pale purple if (ctx._source?.exif_fnumber != null) { String aperture = ctx._source.exif_fnumber; aperture = aperture.replace(".", ","); if (aperture == "NaN") { aperture = "0.0"; } tags.add("Aperture.f/" + aperture + "#D7BDe2"); } // Display ISO rating in pale blue if (ctx._source?.exif_iso_speed_ratings != null) { tags.add("ISO.ISO" + ctx._source.exif_iso_speed_ratings + "#9AC0CD"); } // Display month and year if (ctx._source?.exif_datetime != null) { SimpleDateFormat parser = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss"); Date date = parser.parse(ctx._source.exif_datetime); SimpleDateFormat yp = new SimpleDateFormat("yyyy"); SimpleDateFormat mp = new SimpleDateFormat("MMMMMMMMM"); String year = yp.format(date); String month = mp.format(date); tags.add("Month." + month); tags.add("Year." + year); }