Runtime field painless script to extract from a field

Hi

Have a field named path with content "first_part/second_part/third_part" and what to extract the first_part with a painless script

Thanks

emit(source.splitOnToken('/')[0])