# Setting a breakpoint in elasticsearch plugin (IntelliJ comunity edition)

**URL:** <https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295>\
**Category:** Elasticsearch\
**Created:** [March 25, 2013, 3:36pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295 "2013-03-25T15:36:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![q42jaap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/q42jaap/32/2241_2.png) [@q42jaap](https://discuss.elastic.co/u/q42jaap)\
**Post date:** [March 25, 2013, 3:36pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/1 "2013-03-25T15:36:43Z")

</div>

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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 25, 2013, 3:44pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/2 "2013-03-25T15:44:52Z")

</div>

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 [GitHub - spinscale/elasticsearch-suggest-plugin: Plugin for elasticsearch which uses the lucene FSTSuggester](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](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](mailto: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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 25, 2013, 4:07pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/3 "2013-03-25T16:07:10Z")

</div>

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 🙂

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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![q42jaap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/q42jaap/32/2241_2.png) [@q42jaap](https://discuss.elastic.co/u/q42jaap)\
**Post date:** [March 25, 2013, 4:13pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/4 "2013-03-25T16:13:35Z")

</div>

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](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](mailto: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  
> 🙂
> 
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [March 25, 2013, 11:55pm UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/5 "2013-03-25T23:55:29Z")

</div>

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](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](mailto: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  
> > 🙂
> > 
> > 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](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:44am UTC](https://discuss.elastic.co/t/setting-a-breakpoint-in-elasticsearch-plugin-intellij-comunity-edition/11295/6 "2017-07-06T02:44:31Z")

</div>


