Elasticsearch 2.4.x dynamic scripting Enable?

XxUnkn0wnxX

Active member
so how do I know if xf-date-weighted.groovy is working? because I have "Use dynamic scripting in Elasticsearch" enabled in XF options
but its disabled by Default and trying do

script.inline: true
script.indexed: true

in the elasticsearch.yml

elasticsearch won't start throws this at me:

Code:
script.inline: true
script.indexed: true; line: 95, column: 1]]; nested: ParserException[expected '<document start>', but found BlockMappingStart
 in 'reader', line 95, column 1:
    script.inline: true
    ^
];
Likely root cause: expected '<document start>', but found BlockMappingStart
 in 'reader', line 95, column 1:
    script.inline: true
    ^

    at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(ParserImpl.java:225)
    at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
    at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:340)
    at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:53)
    at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:72)
    at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:45)
    at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:46)
    at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1080)
    at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1067)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:88)
    at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:218)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:257)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
without those variables it start but with this message in the log:

Code:
[2016-11-01 17:19:42,072][INFO ][node                     ] [Nocturne] version[2.4.1], pid[28005], build[c67dc32/2016-09-27T18:57:55Z]
[2016-11-01 17:19:42,072][INFO ][node                     ] [Nocturne] initializing ...
[2016-11-01 17:19:42,473][INFO ][plugins                  ] [Nocturne] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2016-11-01 17:19:42,488][INFO ][env                      ] [Nocturne] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [1.5tb], net total_space [1.7tb], spins? [unknown], types [rootfs]
[2016-11-01 17:19:42,488][INFO ][env                      ] [Nocturne] heap size [7.9gb], compressed ordinary object pointers [true]
[2016-11-01 17:19:43,448][INFO ][script                   ] [Nocturne] compiling script file [/etc/elasticsearch/scripts/xf-date-weighted.groovy]
[2016-11-01 17:19:43,655][WARN ][watcher                  ] cannot notify file changes listener
java.lang.IllegalArgumentException: script file extension not supported [mvel]
    at org.elasticsearch.script.ScriptService.getScriptEngineServiceForFileExt(ScriptService.java:220)
    at org.elasticsearch.script.ScriptService.access$1300(ScriptService.java:82)
    at org.elasticsearch.script.ScriptService$ScriptChangesListener.onFileInit(ScriptService.java:531)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.onFileCreated(FileWatcher.java:256)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.init(FileWatcher.java:166)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.createChild(FileWatcher.java:173)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.listChildren(FileWatcher.java:188)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.onDirectoryCreated(FileWatcher.java:299)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.init(FileWatcher.java:162)
    at org.elasticsearch.watcher.FileWatcher$FileObserver.access$000(FileWatcher.java:75)
    at org.elasticsearch.watcher.FileWatcher.doInit(FileWatcher.java:65)
    at org.elasticsearch.watcher.AbstractResourceWatcher.init(AbstractResourceWatcher.java:36)
    at org.elasticsearch.watcher.ResourceWatcherService.add(ResourceWatcherService.java:133)
    at org.elasticsearch.watcher.ResourceWatcherService.add(ResourceWatcherService.java:126)
    at org.elasticsearch.script.ScriptService.<init>(ScriptService.java:191)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:50)
    at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
    at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
    at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
    at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
    at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
    at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
    at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
    at org.elasticsearch.common.inject.SingleParameterInjector.inject(SingleParameterInjector.java:42)
    at org.elasticsearch.common.inject.SingleParameterInjector.getAll(SingleParameterInjector.java:66)
    at org.elasticsearch.common.inject.SingleMethodInjector.inject(SingleMethodInjector.java:70)
    at org.elasticsearch.common.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:96)
    at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:95)
    at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:104)
    at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
    at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:886)
    at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:43)
    at org.elasticsearch.common.inject.Scopes$1$1.get(Scopes.java:59)
    at org.elasticsearch.common.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:46)
    at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:201)
    at org.elasticsearch.common.inject.InjectorBuilder$1.call(InjectorBuilder.java:193)
    at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:879)
    at org.elasticsearch.common.inject.InjectorBuilder.loadEagerSingletons(InjectorBuilder.java:193)
    at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:175)
    at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
    at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
    at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
    at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:46)
    at org.elasticsearch.node.Node.<init>(Node.java:213)
    at org.elasticsearch.node.Node.<init>(Node.java:140)
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
[2016-11-01 17:19:44,001][INFO ][node                     ] [Nocturne] initialized
[2016-11-01 17:19:44,001][INFO ][node                     ] [Nocturne] starting ...
[2016-11-01 17:19:44,092][INFO ][transport                ] [Nocturne] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2016-11-01 17:19:44,097][INFO ][discovery                ] [Nocturne] xenportal/JhMq9X8WQiSTL6cFtpCFfQ
[2016-11-01 17:19:47,123][INFO ][cluster.service          ] [Nocturne] new_master {Nocturne}{JhMq9X8WQiSTL6cFtpCFfQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-11-01 17:19:47,135][INFO ][http                     ] [Nocturne] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2016-11-01 17:19:47,135][INFO ][node                     ] [Nocturne] started
[2016-11-01 17:19:47,284][INFO ][gateway                  ] [Nocturne] recovered [1] indices into cluster_state
[2016-11-01 17:19:48,499][INFO ][cluster.routing.allocation] [Nocturne] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[xenportal][0], [xenportal][0]] ...]).
it say [Nocturne] compiling script file [/etc/elasticsearch/scripts/xf-date-weighted.groovy] does this mean it working without the dynamic thing enabled in the elasticsearch config file?

but what is with this error: java.lang.IllegalArgumentException: script file extension not supported [mvel]

should I delete xf-date-weighted.mvel?

and if dynamic scripting cannot be enabled how do I call
xf-date-weighted.groovy then?

what do I set/configure in Xenforo & elasticsearch config?
 

Mike

XenForo developer
Staff member
The primary error you're showing appears to be related to the "script.inline" line you've added -- the configuration to enable that is very different in more recent versions of Elasticsearch.

But you don't need that if you've copied the scoring script to Elasticsearch's scripts directory anyway; if you've done that, you don't want to enable dynamic scripting within XF. (And you can remove the mvel version as it's only there for older versions of Elasticsearch now.)
 
Top