Elasticsearch 创建索引
1.创建索引,支持实体转map
public boolean createIndex(T entity) {
String index = indexName(entity);
try {
CreateIndexRequest request = new CreateIndexRequest(index);
request.mapping(toMapping(entity));
client.indices().create(request, RequestOptions.DEFAULT);
} catch (IOException e) {
log.error("索引创建失败,Exception:", e);
}
return false;
}
/**
* 文档类型创建
*
* @param entity
*
共有 0 条评论