elasticsearch之所以功能比较强大,更多的是因为其插件机制比较灵活,可以直接不需要改动源码的情况下,被es的节点扫描加载。本篇文章就简单的讲一下如何进行调试插件,其实无论是river、analysis或者是其他的plugin,都是差不多的写法,所以我们用其中一个river的插件来演示下如何进行调试。

首先,在github上git clone对应的elasticsearch的源码,然后在intellij中将其import进来作为project。

然后,在github上git cloneelasticsearch-rabbitmq-river的源码,然后在intellij中作为elasticsearch项目的一个module进行import。

效果如图,

intellij 开发调试elasticsearch插件

接下来进行运行,这步是最重要的,也是如何让plugin可以在elasticsearch加载的关键。

1、点击run菜单选择-》configure

2、新建一个application,Main class 选择 org.elasticsearch.bootstrap.Bootstrap

3、Vm options 中填 -Des.foreground=true 保证可以让es在前台运行,并输出日志

4、最重要的,将Use classpath of module选择为插件的项目,即elasticsearch-river-rabbitmq

最后、Debug as 就OK了。

intellij 开发调试elasticsearch插件

相关文章:

  • 2021-04-01
  • 2021-12-07
  • 2021-10-25
  • 2021-12-17
  • 2021-11-25
  • 2022-12-23
  • 2022-01-24
  • 2021-11-18
猜你喜欢
  • 2022-01-14
  • 2021-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-12-31
  • 2022-03-14
  • 2022-12-23
相关资源
相似解决方案