Hello, tell me if it's possible to filter aggregation by scriptfield range
[hits] => Array ( ... [hits] => Array (  => Array ( ... [fields] => Array ( [price] => Array (  => 144360 ) ) ) ) )
my aggrigation (filtering occurs by the price field in _source)
Array ( [filters] => Array ( [filters] => Array ( [brand:1] => Array ( [bool] => Array ( [filter] => Array (  => Array ( [range] => Array ( [price] => Array <--- filtered by price in _source ( [gt] => 526 [lt] => 22032 ) ) ) ) ) ) ) )
'price' => [ 'script' => [ "lang" => "painless", //this is to measure that the document may or may not be subject to currency 'source' => "emit(doc['currency'].empty ? doc['price'].value * params.currency : doc['price'].value)", "params" => [ "currency" => 40 ] ], ], ]
In the _source, I also have a price field, but the filtering takes place exactly on it, How to make range work with a scriptfield.
The final task is to dynamically impose the exchange rate on the price and filter the price taking into account the exchange rate.
Can anyone help or tell me what I'm doing wrong?