Springboot Mysql数据导入elasticsearch。
一个数据库的所有数据当然传单个的可以在代码上修改即可
DomeApplicationRun.java
package org.bw;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.frameworkset.elasticsearch.client.DataStream;
import org.frameworkset.elasticsearch.client.ImportBuilder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class DomeApplicationRun {
public static void main(String[] args) {
SpringApplication.run(DomeApplicationRun.class, args);
}
/**
* mysql传输到elasticsearch
* @param str
*/
public void testSimpleLogImportBuilderFromExternalDBConfig(String str){
ImportBuilder importBuilder = ImportBuilder.newInstance()