What is the optimal way to check if array is not empty in function_score query?

Hello,

In our documents, there is an array field which holds URLs to the entity pictures. Naturally, we want to score documents with pictures present higher than documents w/o pictures.

According to my experience, we either can add a new field to cache amount of entries in the photos array, something like photos_count or use dynamic scripting to check photos length.

We don't have any problems with performance just yet, but, I still wonder if there is any other, more straightforward way to prioritize documents which photos array is not empty.