I have a query which looks like this:
query = {
'from': start,
'size': limit,
'query': {
'function_score': {
'query': {
'match': {
'some_field': search,
},
},
'script_score': {
'script': {
'lang': 'painless',
'inline': 'freq_payloads_cosine',
'params': {
'query_words': search,
}
}
}
}
}
}
And a freq_payloads_cosine.painless
script. Right now, I'm repeating "search" in both the query and the script score. I was wondering if instead there was a way to access the query from within the painless script without passing it as a parameter explicitly. Preferably, I'd like to access the analyzed/tokenized representation of the query since "some_field" has a custom analyzer. Is that possible?
Thanks.