ElasticSearch5.3插件开发(一)控制台打印信息
自定義插件類繼承org.elasticsearch.plugins.Plugin
本文最簡單的一個插件,在控制臺打印信息:
package es.plugins;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import java.util.Collections;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.rest.RestHandler;
public class MyFirstPlugin extends Plugin implements ActionPlugin{
?? ?private final static Logger LOGGER = LogManager.getLogger(MyFirstPlugin.class);
??? public MyFirstPlugin() {
??????? super();
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.info("This is my fisrt Plugin");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??????? LOGGER.warn("Create the Basic Plugin and installed it into elasticsearch");
??? }
?? ?
?
}
打包成jar包,在plugin目錄下新建一個文件夾,然后放入jar包,添加配置文件plugin-descriptor.properties
文件內(nèi)容如下
description=hello?for?ElasticSearch?
version=1.0??
name=HelloWorldPlugin??
site=${elasticsearch.plugin.site}?
jvm=true??
classname=org.elasticsearch.plugin.helloworld.MyFirstPlugin???? //類全名
java.version=1.7??
elasticsearch.version=2.2.0?
isolated=${elasticsearch.plugin.isolated}?
總結(jié)
以上是生活随笔為你收集整理的ElasticSearch5.3插件开发(一)控制台打印信息的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: input两种默认显示文字方式
- 下一篇: dojo使用query dojo/que