Setting a breakpoint in elasticsearch plugin (IntelliJ comunity edition)

Hi,

I'm thinking about developing an elasticsearch plugin and I would like to
be able to start elasticsearch with my plugin loaded from within IntelliJ.
I couldn't find how I should do this.

I would also like to be able to set breakpoints, I've seen some discussion
about debugging, and I've seen that people say they just log a lot (which I
personally don't like when debugging a complex algoritm).
So how would I set up:

  1. starting elasticsearch with the plugin loaded (would love that from
    within IntelliJ but commandline is also a good workflow for me).
  2. set a breakpoint in my plugin code and let IntelliJ hit it.

and possibly:
3. attach the ElasticSearch source to IntelliJ for hard-core debugging.

Thanks!

Jaap

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey Jaap,

I do this with all my plugins, not sure where your problem exactly is. As
long as you have an es-plugin.properties file pointing to your plugin in
your classpath, you do not have any problem, starting elasticsearch from
your IDE with the help of the NodeBuilder class.

Take a look at https://github.com/spinscale/elasticsearch-suggest-plugin
or more specifically in
https://github.com/spinscale/elasticsearch-suggest-plugin/tree/master/src/test/java/de/spinscale/elasticsearch/module/suggest/test

You can start all those tests directly from your IDE, in debug mode, with
breakpoints attached.
This should help you to test all your plugin code in your favorite IDE. In
case of questions, just ask, I'm glad to help.

--Alex

On Mon, Mar 25, 2013 at 4:36 PM, Jaap Taal jaap@q42.nl wrote:

Hi,

I'm thinking about developing an elasticsearch plugin and I would like to
be able to start elasticsearch with my plugin loaded from within IntelliJ.
I couldn't find how I should do this.

I would also like to be able to set breakpoints, I've seen some discussion
about debugging, and I've seen that people say they just log a lot (which I
personally don't like when debugging a complex algoritm).
So how would I set up:

  1. starting elasticsearch with the plugin loaded (would love that from
    within IntelliJ but commandline is also a good workflow for me).
  2. set a breakpoint in my plugin code and let IntelliJ hit it.

and possibly:
3. attach the ElasticSearch source to IntelliJ for hard-core debugging.

Thanks!

Jaap

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  1. Install the IntelliJ TestNG plugin. Write your ES plugin test
    framework (start node with plugin, stop node) as TestNG tests for maven
    surefire (just like ES does in master). Use right-mouse-button popup
    menu "Debug - All tests" (first entry is JUnit, second entry is TestNG)
    to start tests. YMMV because a target JVM is started by IntelliJ und
    controlled via a socket.

  2. Just configure your breakpoints in the menu "Run" (Toggle ...
    breakpoint)

  3. Elasticsearch source can be easily added if you have cloned from
    github und imported it into IntelliJ.

Maybe it's also possible to write ES test framework in JUnit. But I find
TestNG way more easier and it works like a charme.

I find extensive logging more useful because I was born on the command
line :slight_smile:

Jörg

Am 25.03.13 16:36, schrieb Jaap Taal:

Hi,

I'm thinking about developing an elasticsearch plugin and I would like
to be able to start elasticsearch with my plugin loaded from within
IntelliJ.
I couldn't find how I should do this.

I would also like to be able to set breakpoints, I've seen some
discussion about debugging, and I've seen that people say they just
log a lot (which I personally don't like when debugging a complex
algoritm).
So how would I set up:

  1. starting elasticsearch with the plugin loaded (would love that from
    within IntelliJ but commandline is also a good workflow for me).
  2. set a breakpoint in my plugin code and let IntelliJ hit it.

and possibly:
3. attach the ElasticSearch source to IntelliJ for hard-core debugging.

Thanks!

Jaap

You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks a lot guys, I'm going to try that, my problem was that I had no
clue how to start it all...
I was working on Jorg's elasticsearch-index-termlist and I did it with
repeatedly starting and stopping a standalone instance of
elasticsearch and installing the plugin with plugin.bat.

I was just lucky to get it right after a couple of tries, otherwise I
would have given up!
Jaap Taal

[ Q42 BV | tel 070 44523 42 | direct 070 44523 65 | http://q42.nl |
Waldorpstraat 17F, Den Haag | Vijzelstraat 72 unit 4.23, Amsterdam |
KvK 30164662 ]

On Mon, Mar 25, 2013 at 5:07 PM, Jörg Prante joergprante@gmail.com wrote:

  1. Install the IntelliJ TestNG plugin. Write your ES plugin test framework
    (start node with plugin, stop node) as TestNG tests for maven surefire (just
    like ES does in master). Use right-mouse-button popup menu "Debug - All
    tests" (first entry is JUnit, second entry is TestNG) to start tests. YMMV
    because a target JVM is started by IntelliJ und controlled via a socket.

  2. Just configure your breakpoints in the menu "Run" (Toggle ...
    breakpoint)

  3. Elasticsearch source can be easily added if you have cloned from github
    und imported it into IntelliJ.

Maybe it's also possible to write ES test framework in JUnit. But I find
TestNG way more easier and it works like a charme.

I find extensive logging more useful because I was born on the command line
:slight_smile:

Jörg

Am 25.03.13 16:36, schrieb Jaap Taal:

Hi,

I'm thinking about developing an elasticsearch plugin and I would like to
be able to start elasticsearch with my plugin loaded from within IntelliJ.
I couldn't find how I should do this.

I would also like to be able to set breakpoints, I've seen some discussion
about debugging, and I've seen that people say they just log a lot (which I
personally don't like when debugging a complex algoritm).
So how would I set up:

  1. starting elasticsearch with the plugin loaded (would love that from
    within IntelliJ but commandline is also a good workflow for me).
  2. set a breakpoint in my plugin code and let IntelliJ hit it.

and possibly:
3. attach the ElasticSearch source to IntelliJ for hard-core debugging.

Thanks!

Jaap

You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Not sure if this is what you are looking for, but if you want to just see
your plugin running inside elasticsearch you can do this:

  1. Copy config directory from elasticsearch Project to your plugin project
    (optional)
  2. Menu Run -> Edit Configurations -> "+" -> Application
  3. On Application Dialog: Set
  • Main class to org.elasticsearch.bootstrap.Bootstrap
  • VM Options to -Des.foreground=true or if you didn't copy config in 1)
    also add to VM Options -Des.path.home=*
    some/directory/with/elasticsearch/config*
  1. Click OK
  2. Set breakpoint in your plugin
  3. Menu Run -> Debug Bootstrap

On Monday, March 25, 2013 12:13:35 PM UTC-4, Jaap Taal wrote:

Thanks a lot guys, I'm going to try that, my problem was that I had no
clue how to start it all...
I was working on Jorg's elasticsearch-index-termlist and I did it with
repeatedly starting and stopping a standalone instance of
elasticsearch and installing the plugin with plugin.bat.

I was just lucky to get it right after a couple of tries, otherwise I
would have given up!
Jaap Taal

[ Q42 BV | tel 070 44523 42 | direct 070 44523 65 | http://q42.nl |
Waldorpstraat 17F, Den Haag | Vijzelstraat 72 unit 4.23, Amsterdam |
KvK 30164662 ]

On Mon, Mar 25, 2013 at 5:07 PM, Jörg Prante <joerg...@gmail.com<javascript:>>
wrote:

  1. Install the IntelliJ TestNG plugin. Write your ES plugin test
    framework
    (start node with plugin, stop node) as TestNG tests for maven surefire
    (just
    like ES does in master). Use right-mouse-button popup menu "Debug - All
    tests" (first entry is JUnit, second entry is TestNG) to start tests.
    YMMV
    because a target JVM is started by IntelliJ und controlled via a socket.

  2. Just configure your breakpoints in the menu "Run" (Toggle ...
    breakpoint)

  3. Elasticsearch source can be easily added if you have cloned from
    github
    und imported it into IntelliJ.

Maybe it's also possible to write ES test framework in JUnit. But I find
TestNG way more easier and it works like a charme.

I find extensive logging more useful because I was born on the command
line
:slight_smile:

Jörg

Am 25.03.13 16:36, schrieb Jaap Taal:

Hi,

I'm thinking about developing an elasticsearch plugin and I would like
to

be able to start elasticsearch with my plugin loaded from within
IntelliJ.

I couldn't find how I should do this.

I would also like to be able to set breakpoints, I've seen some
discussion

about debugging, and I've seen that people say they just log a lot
(which I

personally don't like when debugging a complex algoritm).
So how would I set up:

  1. starting elasticsearch with the plugin loaded (would love that from
    within IntelliJ but commandline is also a good workflow for me).
  2. set a breakpoint in my plugin code and let IntelliJ hit it.

and possibly:
3. attach the ElasticSearch source to IntelliJ for hard-core debugging.

Thanks!

Jaap

You received this message because you are subscribed to the Google
Groups

"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an

email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.