1、Code -> GitHub
https://github.com/liufengji/elasticsearch_api.git
2、源代码
@Test
public void createIndex_blog(){
// 1 创建索引
client.admin().indices().prepareCreate("blog2").get();
// 2 关闭连接
client.close();
}
3、查看结果
{"blog2":{"aliases":{},"mappings":{},"settings":{"index":{"creation_date":"1507466730030","number_of_shards":"5","number_of_replicas":"1","uuid":"lec0xYiBSmStspGVa6c80Q","version":{"created":"5060299"},"provided_name":"blog2"}}}}