Run/Debug ElasticSearch in IntelliJ

You have not indicated if you are asking to debug / step-into the Elastic Search (ES) client or sever code.

For Client Code

As long as the sources are attached, yes you can debug it. If you are using Maven, you can ask it to download (and attach) the sources assuming they are available in the Maven Central Repository. (Elastic Search does deploy its sources to maven central, so you should be good there. If not, you would have to "manually" attach the source jar in the Project Structure dialog.)

To get maven to download and attach, open the maven tool window and click the "Download..." button enter image description here and select either Download Sources or Download Sources and Documentation. IDEA will now download and attach all the available source (and/or javadoc) JARs for all the dependencies/libraries in your project. If desired, you can configure maven to always do this. To set it for the current project, click the settings button enter image description here in the maven tool window ans select the Importing node, or go to Settings > [Project Settings] > Maven > Importing. In the dialog, check the "Automatically Download" Sources and/or Documentation options. To set this as the default for all future projects you create, go to File > Other Settings > Default Settings > Maven > Importing and make the setting.

Once the sources are attached, you will be able to step into the elastic search code, or open one a class by either 1) using Ctrl+N to search for and enter a class, typing Ctrl+N a second time to include library classes in your search or 2) using Ctrl+B (when your cursor is on a method call) or Ctrl+Click to go to the method declaration. You can then set breakpoints.

For Server Code

You will need to create an elastic search project with the source code. The easiest thing would be to clone their repo (or otherwise check it out). You could also just attach the ES server libraries (including sources) to your project.

If you are running elastic search locally, just create a local Run/Debug configuration to run ES and launch via Debug. If running ES on a remote server, you will need to create a remote debug configuration and then attach to the remote ES server (which will need to be started with the proper Java Debug properties.) See Help > IntelliJ IDEA > Reference > Dialog > Run/Debug Configurations > Run/Debug Configuration: Remote and Help > IntelliJ IDEA > Language and Framework-Specific Guidelines > Java EE > Working with Application Servers > Working with Server Run/Debug Configurations for more information.


Ok found it. Use the Run menu of IntelliJ to add a new run configuration.

  • Run
  • Edit configurations
  • +
  • Set Main class to org.elasticsearch.bootstrap.Bootstrap
  • Set VM options to -Des.foreground=yes

Voila. Credits.