7
7
import org .elasticsearch .client .Client ;
8
8
import org .elasticsearch .client .transport .TransportClient ;
9
9
import org .elasticsearch .common .settings .Settings ;
10
- import org .elasticsearch .common .transport .InetSocketTransportAddress ;
10
+ import org .elasticsearch .common .transport .TransportAddress ;
11
11
import org .elasticsearch .common .xcontent .XContentType ;
12
+ import org .elasticsearch .env .Environment ;
12
13
import org .elasticsearch .index .IndexNotFoundException ;
13
14
import org .elasticsearch .node .InternalSettingsPreparer ;
14
15
import org .elasticsearch .node .Node ;
27
28
import java .net .URL ;
28
29
import java .nio .file .Files ;
29
30
import java .nio .file .StandardCopyOption ;
30
- import java .util .Arrays ;
31
- import java .util .Collection ;
32
- import java .util .LinkedList ;
33
- import java .util .List ;
31
+ import java .util .*;
34
32
35
33
/**
36
34
* Helper class to start/stop elasticsearch node and get elasticsearch clients
@@ -54,8 +52,8 @@ public class Server {
54
52
private Integer shards = null ;
55
53
56
54
protected static class MyNode extends Node {
57
- public MyNode (Settings preparedSettings , Collection < Class <? extends Plugin >> classpathPlugins ) {
58
- super (InternalSettingsPreparer . prepareEnvironment ( preparedSettings , null ), classpathPlugins );
55
+ public MyNode (Environment environment ) {
56
+ super (environment );
59
57
}
60
58
}
61
59
@@ -92,9 +90,9 @@ public Server start() {
92
90
if (index >= 0 ) {
93
91
int port = Integer .parseInt (tAddr .substring (index + 1 ));
94
92
String addrStr = tAddr .substring (0 , index );
95
- trClient .addTransportAddress (new InetSocketTransportAddress (new InetSocketAddress (addrStr , port )));
93
+ trClient .addTransportAddress (new TransportAddress (new InetSocketAddress (addrStr , port )));
96
94
} else {
97
- trClient .addTransportAddress (new InetSocketTransportAddress (new InetSocketAddress (tAddr , 9300 )));
95
+ trClient .addTransportAddress (new TransportAddress (new InetSocketAddress (tAddr , 9300 )));
98
96
}
99
97
}
100
98
@@ -107,9 +105,14 @@ public Server start() {
107
105
try {
108
106
sBuilder .put ("transport.type" , "netty4" ).put ("http.type" , "netty4" ).put ("http.enabled" , "true" );
109
107
Settings settings = sBuilder .build ();
108
+ /*
110
109
Collection<Class<? extends Plugin>> lList = new LinkedList<>();
111
110
lList.add(Netty4Plugin.class);
112
- esNode = new MyNode (settings , lList );
111
+ */
112
+
113
+ Environment environment = new Environment (settings , null );
114
+ esNode = new Node (environment );
115
+ //esNode = new MyNode(settings, lList);
113
116
esNode .start ();
114
117
115
118
log .info ("started elastic search node" );
0 commit comments