# Testing With Delete By Query ElasticSearch Plugin

**URL:** <https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498>\
**Category:** Elasticsearch\
**Created:** [July 14, 2016, 9:32am UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498 "2016-07-14T09:32:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dadepo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadepo/32/19944_2.png) [@dadepo](https://discuss.elastic.co/u/dadepo)\
**Post date:** [July 14, 2016, 9:32am UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498/1 "2016-07-14T09:32:28Z")

</div>

Is there anyway to have integration test for a code that makes use of the delete by query plugin using embedded elasticsearch node?

Right now I get `failed to find action [org.elasticsearch.action.deletebyquery.DeleteByQueryAction`

For various reasons, I can't switch to using the official ElasticSearch testing classes. Is there anyway, whatsoever, in existence, to get an integration test to work using Embedded node with code that makes use of the delete-by-query plugin?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 14, 2016, 11:35am UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498/2 "2016-07-14T11:35:41Z")

</div>

Yes it is possible, but the elasticsearch node needs to be able to load the plugin from classpath. Which version are you on? That makes quite a difference in how you achieve what you want. In general, you can have a look at our InternalTestCluster class that is part of the test-framework, that is where a lot of magic happens.

Note also that we are trying to move away from these kinds of tests where everything happens on the same jvm as they end up not being realistic. It is much better to just start an external cluster and fire http requests to it like we do in our REST tests.

Cheers  
Luca

---

<div class="post-metadata">

**Author:** ![dadepo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadepo/32/19944_2.png) [@dadepo](https://discuss.elastic.co/u/dadepo)\
**Post date:** [July 14, 2016, 11:39am UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498/3 "2016-07-14T11:39:00Z")

</div>

I am running version 2.3.3. How will this be achieved then?

Yes I understand the thinking behind discouraging this kind of tests, but for now, this is the approach I would need to work with ☹

Thanks

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 14, 2016, 12:02pm UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498/4 "2016-07-14T12:02:10Z")

</div>

In 2.3 branch, you would need to write a class that does what MockNode does in our test infra: [https://github.com/elastic/elasticsearch/blob/2.3/core/src/test/java/org/elasticsearch/node/MockNode.java](https://github.com/elastic/elasticsearch/blob/2.3/core/src/test/java/org/elasticsearch/node/MockNode.java) . It allows to call the Node super constructor providing a list of plugins, which need to be available on the classpath. Then you can simply start the node and test against it.

Even if you are not going to use our test-framework, you can still have a look at how that works to figure things out and take inspiration from it. What is possible there is possible without it as well.

Cheers  
Luca

---

<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 5, 2017, 10:35pm UTC](https://discuss.elastic.co/t/testing-with-delete-by-query-elasticsearch-plugin/55498/5 "2017-07-05T22:35:37Z")

</div>


