How to reference a script field value in another script


(za) #1

I calculate a script field (a little performance-expensive) when search, an then I want to reference the script field value in a script sort. I seems elasticsearch not support it now, I can only reference the doc field value in a script sort.

Or I want to reference the script field value in a script_score script, then at the sorting phase I just use the _score value. But It seems I cant reference the script field value in a script_score script too.

Is there some advice to achieve it?


(Mark Walkom) #2

You can't do this unfortunately.

Can you take the results of script 1 and create a new field with it? Then you could reference it.


(system) #3