Debug custom elasticsearch plugin in Intellij

I have gone through this blog and I am able to debug elasticsearch code in Intellij.

Can someone let me know how can I debug a custom plugin code in Intellij now? I have gone through this post and tried to run elasticsearch

./gradlew :plugins:/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip:run --debug-jvm

But it failed with the below error

Project '/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip' not found in project ':plugins'.

I also tried doing

./gradlew :plugins:file:/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip:run --debug-jvm

But still it failed with the below error

Project 'file' not found in project ':plugins'.

Can someone let me know how can I debug a custom elasticsearch plugin code in Intellij?

For custom plugin I am using maven .

By following the instruction mentioned in TESTING.asciidoc I am also able to connect to the remote elastic search from intellij.

But I am still not able to figure out how can I step through my plugin code that is running inside the remote elasticsearch.

Can someone suggest something?

if you are using gradle, you can start your plugin with ./gradlew run --debug-jvm, before the java process starts, you need to attach intellij and then you can step debug through the code by triggering executions (be it an HTTP request, or a cluster state listener or a query).

Yes it is working what you have suggested. Can you let me know how can I do --debug-jvm with custom plugin?

You can call the above gradle command within your own plugin, if you are using the build-tools dependency. See https://github.com/spinscale/elasticsearch-ingest-langdetect for an example.

My plugin is in a maven project. Will this work for maven project also?

No, those buildtools are for gradle only as far as I know. There is a community supported elasticsearch maven plugin, but I have never used it and cannot comment on it further.

Thanks @spinscale for your suggestions.

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