# How Debug custom elasticsearch8.14 plugin in Intellij

**URL:** <https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269>\
**Category:** Elasticsearch\
**Created:** [August 2, 2024, 10:24am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269 "2024-08-02T10:24:02Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 2, 2024, 10:24am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/1 "2024-08-02T10:24:02Z")

</div>

Hello everyone, I am an elasticsearch developer. Due to business needs, I need to develop a plug-in. The logic of this plug-in is relatively complex. I need the degbug plug-in source code. I can debug the plug-in locally in elasticsearch6.8 through the following code,

```auto
public class EmbeddedNode extends Node {

    private Version version;
    private Collection<Class<? extends Plugin>> plugins;

    public EmbeddedNode(Environment environment, Version version, Collection<Class<? extends Plugin>> classpathPlugins) {
        super(environment, classpathPlugins, true);
        this.version = version;
        this.plugins = classpathPlugins;
    }

    public Collection<Class<? extends Plugin>> getPlugins() {
        return plugins;
    }

    public Version getVersion() {
        return version;
    }

    @Override
    protected void registerDerivedNodeNameWithLogger(String nodeName) {

    }
}

```

Modify the startup class and load the custom plug-in org.elasticsearch.bootstrap.Bootstrap

```auto
// Line 227 ExamplePlugin is the main class of the custom plugin
        Collection plugins = new ArrayList<>();
        Collections.addAll(plugins, ExamplePlugin.class);
        node = new EmbeddedNode(environment, Version.CURRENT, plugins) {
            @Override
            protected void validateNodeBeforeAcceptingRequests(
                final BootstrapContext context,
                final BoundTransportAddress boundTransportAddress, List<BootstrapCheck> checks) throws NodeValidationException {
                BootstrapChecks.check(context, boundTransportAddress, checks);
            }
        };

```

But in elasticsearch8.14, I can't find any way to degbug the plugin source code locally. Please help me. Thank you very much.

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [August 2, 2024, 10:34am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/2 "2024-08-02T10:34:34Z")

</div>

From #Elastic Search to #Elasticsearch

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [August 2, 2024, 10:34am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/3 "2024-08-02T10:34:34Z")

</div>

Removed #elastic-app-search

---

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 5, 2024, 10:33am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/4 "2024-08-05T10:33:46Z")

</div>

Can someone help me take a look?

---

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 5, 2024, 10:35am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/5 "2024-08-05T10:35:01Z")

</div>

I actually just want to know how to debug the elasticsearch plugin I developed myself

---

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 5, 2024, 10:43am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/6 "2024-08-05T10:43:56Z")

</div>

@nik9000  
Hello, I saw you answered a related question before, but that was a long time ago, so I would like to ask you how to deg the plugin in elasticsearch 8.14

---

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 6, 2024, 6:01am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/7 "2024-08-06T06:01:36Z")

</div>

@DavidTurner  
Could you please take a look at this issue?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [August 6, 2024, 2:53pm UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/8 "2024-08-06T14:53:32Z")

</div>

I think that you need to run the plugin within an elasticsearch Node and then attach your debugger to the JVM.

Otherwise, I'd recommend may be writing some YAML Rest tests, like  
[Creating text analysis plugins with the stable plugin API | Elasticsearch Plugins and Integrations [8.14] | Elastic](https://www.elastic.co/guide/en/elasticsearch/plugins/current/creating-stable-plugins.html#_yaml_rest_tests)

Finally may be look at [elasticsearch/plugins/examples at main · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/tree/main/plugins/examples) if you need some help about designing plugins.

Not sure it helps though.

---

<div class="post-metadata">

**Author:** ![dean\_winchester](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dean_winchester/32/136482_2.png) [@dean\_winchester](https://discuss.elastic.co/u/dean_winchester)\
**Post date:** [August 9, 2024, 3:34am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/9 "2024-08-09T03:34:10Z")

</div>

Thanks for your reply. I found two other ways to debug local source code.  
I created a submodules in the modules directory, and then copied all the classes of the plugins I developed to the modules, and then modified build.gradle

```auto
esplugin {
name 'rest-handler'
description 'An example plugin showing how to register a REST handler'
classname 'your own plugin path'
licenseFile rootProject.file('SSPL-1.0+ELASTIC-LICENSE-2.0.txt')
noticeFile rootProject.file('NOTICE.txt')
}

```

In this way, I can debug the source code of the plugin I developed myself. Although it is very laborious, I can finally debug it happily.

---

<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:** [September 6, 2024, 3:34am UTC](https://discuss.elastic.co/t/how-debug-custom-elasticsearch8-14-plugin-in-intellij/364269/10 "2024-09-06T03:34:30Z")

</div>

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