How to tweak the lucene core in Elasticsearch

I need to tweak something in lucene core(add diagnostic information to help resolve issues in other part). However I found that elasticsearch refuse to start when a self build jar of lucene core is used, even when what I did is clone the code, check out the corresponding tag, and use ant jar in the lucene/core directory to build the jar file and then use this jar to replace the one in the elasticsearch lib directory. After that, ElasticSearch was not able to start.

The error is :

][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [main], exiting
java.lang.ExceptionInInitializerError: null
at org.apache.lucene.analysis.miscellaneous.StemmerOverrideFilter$Builder.build(StemmerOverrideFilter.java:205) ~[lucene-analyzers-common-6.4.2.jar:6.4.2 34a975ca3d4bd7fa121340e5bcbf165929e0542f - ishan - 2017-03-01 23:25:07]
at org.apache.lucene.analysis.nl.DutchAnalyzer.(DutchAnalyzer.java:133) ~[lucene-analyzers-common-6.4.2.jar:6.4.2 34a975ca3d4bd7fa121340e5bcbf165929e0542f - ishan - 2017-03-01 23:25:07]
at org.apache.lucene.analysis.nl.DutchAnalyzer.(DutchAnalyzer.java:106) ~[lucene-analyzers-common-6.4.2.jar:6.4.2 34a975ca3d4bd7fa121340e5bcbf165929e0542f - ishan - 2017-03-01 23:25:07]
at org.elasticsearch.indices.analysis.PreBuiltAnalyzers$20.create(PreBuiltAnalyzers.java:246) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.indices.analysis.PreBuiltAnalyzers.getAnalyzer(PreBuiltAnalyzers.java:487) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.index.analysis.AnalysisRegistry$PrebuiltAnalysis.(AnalysisRegistry.java:407) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.index.analysis.AnalysisRegistry$PrebuiltAnalysis.(AnalysisRegistry.java:392) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.index.analysis.AnalysisRegistry.(AnalysisRegistry.java:62) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.indices.analysis.AnalysisModule.(AnalysisModule.java:176) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.node.Node.(Node.java:338) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.node.Node.(Node.java:242) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Bootstrap$6.(Bootstrap.java:242) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:242) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:360) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.3.1.jar:5.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.3.1.jar:5.3.1]
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_121]
at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_121]
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_121]
at java.lang.Class.checkMemberAccess(Class.java:2348) ~[?:1.8.0_121]
at java.lang.Class.getDeclaredFields(Class.java:1915) ~[?:1.8.0_121]
at org.apache.lucene.util.RamUsageEstimator$1.run(RamUsageEstimator.java:339) ~[lucene-core-6.4.2-SNAPSHOT.jar:6.4.2-SNAPSHOT 34a975ca3d4bd7fa121340e5bcbf165929e0542f - michael - 2017-04-24 16:51:22]
at org.apache.lucene.util.RamUsageEstimator$1.run(RamUsageEstimator.java:336) ~[lucene-core-6.4.2-SNAPSHOT.jar:6.4.2-SNAPSHOT 34a975ca3d4bd7fa121340e5bcbf165929e0542f - michael - 2017-04-24 16:51:22]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_121]
at org.apache.lucene.util.RamUsageEstimator.shallowSizeOfInstance(RamUsageEstimator.java:336) ~[lucene-core-6.4.2-SNAPSHOT.jar:6.4.2-SNAPSHOT 34a975ca3d4bd7fa121340e5bcbf165929e0542f - michael - 2017-04-24 16:51:22]
at org.apache.lucene.util.RamUsageEstimator.shallowSizeOf(RamUsageEstimator.java:313) ~[lucene-core-6.4.2-SNAPSHOT.jar:6.4.2-SNAPSHOT 34a975ca3d4bd7fa121340e5bcbf165929e0542f - michael - 2017-04-24 16:51:22]
at org.apache.lucene.util.fst.ByteSequenceOutputs.(ByteSequenceOutputs.java:154) ~[lucene-core-6.4.2-SNAPSHOT.jar:6.4.2-SNAPSHOT 34a975ca3d4bd7fa121340e5bcbf165929e0542f - michael - 2017-04-24 16:51:22]
... 21 more

My question is what do I need to do if I want to tweak the lucene core used in ES.

Startup is failing because we only grant permissions to the exact version of Lucene that we depend on. If you want to make changes like this, you have to grant additional permissions to the modified version of Lucene. However, I must advise you that you are in fully unsupported territory here.

Thank you for your help.

You're welcome.

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