-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElasticsearchConfig.java
More file actions
25 lines (20 loc) · 943 Bytes
/
ElasticsearchConfig.java
File metadata and controls
25 lines (20 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.github.ivangomes.elasticsearch;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class ElasticsearchConfig {
public static final String INDEX = "model";
public static final String TYPE = "element";
public static final int DEFAULT_SCROLL_KEEP_ALIVE = 60000;
public static final int DEFAULT_SCROLL_SIZE = 100;
private static TransportClient CLIENT;
public static TransportClient getClient() throws UnknownHostException {
if (CLIENT == null) {
CLIENT = new PreBuiltTransportClient(Settings.EMPTY).addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
}
return CLIENT;
}
}