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!