• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed "painless" script support

Xon

Well-known member
#1
ElasticSearch v5 has yet another new scripting language, with groovy being deprecated.

I've ported the xf-date-weighted.groovy script file to xf-date-weighted.painless
Code:
return _score / Math.pow(2.0F, Math.min(10.0F * params.halflife, Math.abs(params.now - doc['date'].value)) / params.halflife)
Note; requires a code edit to XenForo Enhanced Search to use painless rather than groovy.
 

Mike

XenForo developer
Staff member
#2
I've added support for painless now, though it won't always get immediately enabled. It will be used:
  • In Elasticsearch 6 (on the assumption that Groovy will by removed then)
  • In Elasticsearch 5 when dynamic scripting is activated in the XF options
  • When you add this to config.php:
    Code:
    $config['xfesForcePainless'] = true;
The reasoning is that to use a non-dynamic script approach, you need to manually copy the script file to ES's config/scripts directory and it's quite possible people won't do that during a minor XFES upgrade and I don't want to explicitly break something that still works. The config.php switch is a way to opt into the change.
 

Xon

Well-known member
#3
minor XFES upgrade and I don't want to explicitly break something that still works.
Elastic Search 5.1.1 -> 5.1.2 blocks starting Elastic Search if you still have the old ES_HEAP environment variable defined. :rolleyes:

I'll accept minor upgrades not causing breakages.