Updating index with new field, based on the values of existing fields

Hello,

I have an index with two fields: City_1 and City_2. I would like to create a new field and update all existing documents based on the outcome of the following logical test:
If City_1 = City_2 Then Match Else No Match
So the index would look like this:

City_1 City_2 New_Field
Paris Lion No Match
Madrid Madrid Match

Any tips how could we achieve that?

Use update by query or update APIs
you have examples in the documentation.