Script Field is a list of nested values

Hello, I am new to this ES world and I honestly find it very interesting. I have a problem with fields generated or calculated from others.
Let's say I have a movie and each movie has a list of participants. And said participant has an associated person, and a list of roles. I need a calculated field that returns the people who have the director role.
Something like this because I have erased the rest of the fields:

{
	"film": {
		"mappings": {
			"film": {
				"properties": {
				   	"participations": {
						"type": "nested",
						"include_in_parent": true,
						"properties": {
							"person": {
								"type": "nested",
								"include_in_parent": true,
								"properties": {
									"birthDate": {
										"type": "date",
										"format": "strict_date_optional_time||epoch_millis"
									},
									"name": {
										"type": "string"
									},
									"path": {
										"type": "string"
									},
									"promotionalText": {
										"type": "string"
									},
									"realName": {
										"type": "string"
									},
									"sex": {
										"type": "string"
									},
									"slug": {
										"type": "string"
									},
									"status": {
										"type": "string"
									}
								}
							},
							"roles": {
								"type": "nested",
								"include_in_parent": true
							}
						}
				
				}
			}
		}
	}
}
}

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