![JAR search and dependency download from the Maven repository](/logo.png)
elastic.learn.highrest.HighRestConnect Maven / Gradle / Ivy
The newest version!
package elastic.learn.highrest;
import org.apache.http.HttpHost;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.settings.Settings;
import java.io.IOException;
/**
* unclewang
* 2018/4/6 16:58
* TODO: 主要学习highrest的基本api
*/
public class HighRestConnect {
public static void main(String[] args) {
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new HttpHost("localhost", 9200, "http")));
CreateIndexRequest request = new CreateIndexRequest("twitter");
request.settings(Settings.builder()
.put("index.number_of_shards", 3)
.put("index.number_of_replicas", 2)
);
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy