Sort using painless script


I have a large script used for sorting which exceeds maximum characters count so I split it into two separate scripts. I want to avoid writing a plugin but can't find any solution. I don't use both scripts on each document and I define which script to use based on condition. I tried to store results of script in script fields and to use it for sorting, but that is not supported. Is it possible to use script fields in script sort?

Thanks in advance.

(James Addison) #2

Are you able to change script.max_size_in_bytes?

The size of stored scripts is limited to 65,535 bytes. This can be changed by setting script.max_size_in_bytes setting to increase that soft limit, but if scripts are really large then a native script engine should be considered.

(Ryan Ernst) #3

@nejra You can't use script fields in script sorts, but you can use stored scripts. I suggest you store both scripts, and reference which to use in your client when forming your request.

(system) #4

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