Hey, am looking for a way to pass values from a percentile aggregation to a function_score filter as a param in the script_score field, is this possible?
Something like this:
aggs: {
query_percentiles: {
percentiles: {
keyed: false,
script: {
lang: "painless",
source:
"doc['field'].value"
},
},
},
aggs: {
filter: {
function_score: {
query: {
match_all: {}
},
functions: [
{
script_score: {
script: {
params: {
percentiles: bucket_percentiles?
},
source: `bucket_percentiles[i].value>doc[field].value`
}
}
}
],
}
}
}
}