2 way search by query and incoming docs

hi David and Kathleen, apologies again for breaking the guidelines. will keep in mind for the future.

regarding the Boolean queries, are you suggesting something like this:

"must": {
    "script": {
      "script": {
          "source": """
            double distance = doc['location'].arcDistance(params.lat, params.lon) / 1000;
          
            boolean isWithinDistance = distance <= doc['searchRadius'].value;
            boolean isWithinAge = params.age >= doc['minAge'].value && params.age <= doc['maxAge'].value;
            
            return isWithinDistance && isWithinAge;
          """,
          "params": {
            "lat":51.545874,
            "lon": 0.048306,
            "age": 28
          }
      }
    }
}

the above works but my concern is around efficiency, would you say this is the most efficient way of filtering based on the incoming parameters? is there any other feature that I am not aware of / should look into? thank you so much for your help!