最近项目用到ES数据库的安全模式,于是探测了安全模式和非安全模式下的es写数据效率,大体步骤如下
1、准备测试数据20w条json数据,生产数据代码如下:
package dbtest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import net.sf.json.JSONObject;
public class jsonFile
{
public static void main(String[] args) throws FileNotFoundException
{
File file = new File("E:\\es\\json\\ania50w.json");
PrintStream ps = new PrintStream(new FileOutputStream(file));
String resulte ="";
for (long no = 1; no < 200001; no++)
{
String data1 = "{}";
String date2 = "{}";
JSONObject indexobj = JSONObject.fromObject(data1);
JSONObject lowerIndexobj = new JSONObject();