You used to be able to debug Elasticsearch (and plugins) by doing
./gradlew run --debug-jvm
This would launch Elasticsearch in debug mode, whereby you'd subsequently connect IntelliJ the running Elasticsearch JVM. However, if you try this after Elasticsearch 7.5, you'll get the error:
Running elasticsearch in debug mode, node{::integTest-0} suspending until connected on debugPort 5005
Exec output and error:
| Output for ./bin/elasticsearch-plugin:ERROR: transport error 202: connect failed: Connection refused
| ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
| JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:735]
The classic way of debugging Elasticsearch has changed as of ES 7.5, and now you must configure IntelliJ to listen on 5005 prior to running ./gradlew run --debug-jvm
. Here's what you need to do:
Be sure you have a recent version of IntelliJ:
- Create a new Remote run config, in that config:
- Set "Debugger Mode" to "Listen to Remove JVM"
- Click "Auto Restart" (missing from earlier versions of IntelliJ)
Run this Configuration, and IntelliJ will listen for a debug connection...
Back to your command line, run ./gradlew run --debug-jvm
and you should be able debug Elasticsearch