Unable to start Elasticsearch 7.6.2 due to java.lang.NoSuchFieldError: LUCENE_6_0_0

Hi there

I'm upgrading Elasticsearch, Kibana and Filebeat to their respective latest versions, starting with Elasticsearch. I took a backup of all the indices before starting. This is a single node in a dev environment. There's no other nodes.

I've attempted to upgrade Elasticsearch 6.0.1 to 6.8 and then finally to 7.6.2

I attempt to start elasticsearch using the below:

systemctl start elasticsearch.service

No error output is written to /var/log/elasticsearch/elasticsearch.log, however I can see the below output with

journalctl -u elasticsearch.service
May 11 21:39:42  systemd[1]: Starting Elasticsearch...
May 11 21:39:43  elasticsearch[1801]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
May 11 21:39:45  elasticsearch[1801]: Exception in thread "main" java.lang.NoSuchFieldError: LUCENE_6_0_0
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.Version.<clinit>(Version.java:39)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.io.stream.StreamOutput.<init>(StreamOutput.java:76)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.io.stream.BytesStream.<init>(BytesStream.java:24)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:59)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:56)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.io.stream.BytesStreamOutput.<init>(BytesStreamOutput.java:46)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.xcontent.XContentBuilder.builder(XContentBuilder.java:69)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting.arrayToParsableString(Setting.java:1049)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting.access$600(Setting.java:81)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting$ListSetting.lambda$new$0(Setting.java:757)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting$ListSetting.getRaw(Setting.java:765)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting.get(Setting.java:350)
May 11 21:39:45  elasticsearch[1801]: at org.elasticsearch.common.settings.Setting.get(Setting.java:346)
May 11 21:39:45  systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
May 11 21:39:45  systemd[1]: Failed to start Elasticsearch.
May 11 21:39:45  systemd[1]: Unit elasticsearch.service entered failed state.
May 11 21:39:45  systemd[1]: elasticsearch.service failed.

Other info:

yum info elasticsearch
Installed Packages
Name        : elasticsearch
Arch        : x86_64
Version     : 7.6.2
Release     : 1
Size        : 475 M
Repo        : installed
From repo   : elasticsearch
Summary     : Distributed RESTful search engine built for the cloud
URL         : https://www.elastic.co/
License     : Elastic License
Description : Reference documentation can be found at
            :   https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
            :   and the 'Elasticsearch: The Definitive Guide' book can be found at
            :   https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
/etc/elasticsearch/elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

Did you create indices with a 5.x version?

Sorry, I should have mentioned, the indices were created on 6.0.1.

Weird as:

  • Elasticsearch 7 uses Lucene 8 and can read Lucene 7
  • Elasticsearch 6 uses Lucene 7 and can read Lucene 6
  • Elasticsearch 5 uses Lucene 6

So are you sure that absolutely no index has been created with a previous version?
When you upgraded to 6.8, did you run then the upgrade assistant in Kibana?

Indexes were created on 6.0.1.

I did not run the upgrade assistant in Kibana once on 6.8.

Could you do it?

No sadly, Kibana won't start either. Version 7.6.2.
Here's the error log:

{"type":"log","@timestamp":"2020-05-11T12:44:51Z","tags":["fatal","root"],"pid":28246,"message":"TypeError: asts.alwaysAdvancesOnSuccess is not a function\n    at /usr/share/kibana/node_modules/pegjs/lib/compiler/passes/report-left-recursion.js:34:22\n    at Object.every (/usr/share/kibana/node_modules/pegjs/lib/utils/arrays.js:87:12)\n    at sequence (/usr/share/kibana/node_modules/pegjs/lib/compiler/passes/report-left-recursion.js:31:14)\n    at visit (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:10:35)\n    at visitExpression (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:18:13)\n    at visit (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:10:35)\n    at rule (/usr/share/kibana/node_modules/pegjs/lib/compiler/passes/report-left-recursion.js:26:7)\n    at visit (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:10:35)\n    at /usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:40:21\n    at Object.each (/usr/share/kibana/node_modules/pegjs/lib/utils/arrays.js:63:7)\n    at grammar (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:39:20)\n    at visit (/usr/share/kibana/node_modules/pegjs/lib/compiler/visitor.js:10:35)\n    at reportLeftRecursion (/usr/share/kibana/node_modules/pegjs/lib/compiler/passes/report-left-recursion.js:50:3)\n    at /usr/share/kibana/node_modules/pegjs/lib/compiler.js:49:50\n    at Object.each (/usr/share/kibana/node_modules/pegjs/lib/utils/arrays.js:63:7)\n    at Object.compile (/usr/share/kibana/node_modules/pegjs/lib/compiler.js:49:16)"}

Hi there,

Elastic 7.x has stopped using various things, either deprecated or modified. This is true for entire ELK stack. Right now I can only think of is that perhaps you are using a config from 6.x that is part of "breaking changes" considered in 7.x

For example, we were on 7.2 and were upgrading to 7.5. We were using "type" field which was announced to be deprecated from 7.4 I guess. We didn't realise this and our stack was not starting after upgrade. Then we realised the issue and fixed it.

So I suggest you to have a quick look at the Release notes and "breaking changes" list of 7.x to see if there is anything that you were using in 6.x but is now not allowed in 7.x

Hope it helps.

Also note that Kibana will not start unless Elasticsearch starts into normal operation.

I meant. Could you:

  • start a 6.8 cluster
  • restore your snapshot
  • start Kibana
  • run the upgrade assistant

I finally managed to get Elasticsearch running. The problem was that the uninstallation/upgrade process had left orphaned files from version 6.0.1. The solution was to completely delete /usr/share/elasticsearch/* as mentioned here: Version 6.4.2 does not start (java.lang.NoSuchFieldError: LOG_DEFAULT_LEVEL_SETTING) and make sure Elasticsearch 6.0.1 was completed uninstalled before installing a fresh copy of 7.6.2.

Additionally, I had to chown -R elasticsearch:elasticsearch /opt/elasticsearch/ (the location of my indices) because the old elasticsearch user was still set as the owner of the directory and the fresh install of 7.6.2 had not corrected that.

I also encountered the same problem mentioned here Problems with access to Elasticsearch form outside machine and setting discovery.seed_hosts: [] solved that.