Function score and nested query: use hit count in score?

Hello!
I have an object with array of children objects. I'm using nested queries to retrieve relevant children objects along with parents.

What I want to do is calculate final score for objects by function, using 1. _score of object itself, 2. max _score of found nested object, 3. count of inner_hits.

Is it possible to do?