需要为 IndexRequest 设置索引属性:
// 指定要写入的 Index
indexRequest.index("test");
// 指定要写入的本条数据的 ID
indexRequest.id(data._1);
// 设置索引属性值
indexRequest.type("_doc");
// 指定要写入的数据内容 , XContentType.JSON 指定数据格式是 JSON
indexRequest.source(data._2, XContentType.JSON);
IndexResponse indexResponse = httpEsClient.index(indexRequest, RequestOptions.DEFAULT);