Hi,
I may not be using it correctly but when I access source() from inn native (java) script implemented as a plugin from aggregations performance drops dramatically. For example for a small data set of 15000 documents when doing terms aggregation with my script it takes 1.5 seconds to complete. For test I returned from the script without accessing source() - just returned an int between 0 and 50 and it only takes few milliseconds. As soon as source() is involved it drops to over one second.
I suspect it is because of loading and parsing the source where I should have been using doc values in my script instead. Could you point me to an example or docs on how best to access document fields in native scripts?
PS: I need access to multiple document fields so value script is probably not an option
Thanks
Alex