I am using a painless script to implement a custom scoring function while querying the ES index, that's being used as a basis for our recommendation engine. While calculating the final score in the painless script, I use a product of intermediate variables such as recency and uniqueness, calculated within the painless script.
Now, it is trivial to get the final scores of the top documents as they are returned within the query response. However, for detailed analysis, I'm trying to find a way to also get the intermediate variables' values (recency and uniqueness as in the above example). I understand these painless variables only exist within the context of the painless script, which does not have standard REPL setup. So is there really no way to access these painless variables? Has anyone found a workaround to do this? Thanks!
E.g. If I have the following simplified painless script:
def recency = 1/doc['date'].value def uniqueness = doc['ctr].value return recency * uniqueness
In the final ES response, I get the final script scores i.e.
recency * uniqueness . However, I also want to know what the intermediate variables are i.e.