Compare 2 fields in different indexes in Kibana

Hi. I would like to create a report in Kibana that compares the value of 2 fields that exist in different indexes, and output a True or False if they do or do not match. E.g.

index1.fieldA, index2.fieldA, is_match

I was looking to use a Runtime field for 'is_match' with a script such as:

if (doc['index1.fieldA'].value == doc['index2.fieldA'].value)
{
    emit("True");
}
else
{
    emit("False");
}

But it doesn't seem to like the 2 different index prefixes. Is there a way I can accomplish this?

Thanks in advance.

Unfortunately, this won't work because runtime fields work on the fields of a single document at at time.

I'm not sure I follow this premise, because indices have documents, and documents have fields. How would the script know which document in the 2nd index to compare fields with?