导入包
org.elasticsearch.client
transport
5.2.2
org.apache.logging.log4j
log4j-api
2.7
org.apache.logging.log4j
log4j-core
2.7
junit
junit
RELEASE
View Code
2.Java操作
基本操作通过client客户端对象获得客户端然后通过preparIndex等方法传入index,type,id参数和Kibaan中的操作一样
public class EsTest {
//创建客户端
public TransportClient createClient() throws UnknownHostException {
return new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
}
//添加方法