我想在Java中使用散装以更快地为对象数组建立索引。我可以一次在数据库中使用散装为数组列表建立索引吗?
我如何使用它?
我的代码;
List<Log> log;
final WriteRequest.RefreshPolicy[] policy = new WriteRequest.RefreshPolicy[1];
policy[0] = WriteRequest.RefreshPolicy.IMMEDIATE;
BulkResponse response;
BulkRequestBuilder bulkRequest = TRANSPARENT_CLIENT.prepareBulk();
bulkRequest.setRefreshPolicy(policy[0]);
JSONArray jsons = new JSONArray();
try {
bulkRequest.add(
TRANSPARENT_CLIENT.prepareIndex(
"test",
DB_TYPE)
.setSource(JsonUtil.toJsonArray(log))
);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
response = bulkRequest.get();
我的错误:
Validation Failed: 1: content type is missing!