Can aggregations values be used in script score calculations?

Each one of my documents within my index contains values associated with sales data and I calculate a score for each document based on those values. Currently, the values are bucketed globally, meaning that before indexing these values we bucketize the entire set and index them into ES. I'd like to bucket these values at the query level and then calculate the document scores. Is it possible to use aggregation values within the script score functionality? Are there better ways of achieving a similar outcome?

Links to pertinent links or docs also welcome!

Cheers & Thank you!


this is not possible as aggregation calculation happens at a very different level than the score calculation. I'm still not super sure about the use-case, but it seems that reindexing/updating your data based on your queries sounds like a plan in this use-case, as the scores seem to change with the data being indexed, this cannot be done at index time.


1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.