cloud
This commit is contained in:
parent
aa8af0bfd4
commit
b6b5a0f42e
16
pom.xml
16
pom.xml
@ -38,6 +38,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>x-pack-transport</artifactId>
|
||||
<version>6.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -116,6 +121,17 @@
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<!-- add the elastic repo -->
|
||||
<repository>
|
||||
<id>elastic</id>
|
||||
<url>https://artifacts.elastic.co/maven</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
|
@ -1,11 +1,15 @@
|
||||
package com.manalejandro.arjion;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
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 org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -36,15 +40,36 @@ public class ESConfig {
|
||||
private String documentType;
|
||||
|
||||
private TransportClient client;
|
||||
|
||||
String clusterId = "2be3ffc1fd284a8788906e5022d0cb18"; // Your cluster ID here
|
||||
String region = "eu-central-1"; // Your region here
|
||||
boolean enableSsl = true;
|
||||
|
||||
@Bean
|
||||
public Client client() throws Exception {
|
||||
public Client client() {
|
||||
Settings settings = Settings.builder()
|
||||
.put("client.transport.nodes_sampler_interval", "5s")
|
||||
.put("client.transport.sniff", false)
|
||||
.put("transport.tcp.compress", true)
|
||||
.put("cluster.name", EsClusterName)
|
||||
.put("xpack.security.transport.ssl.enabled", enableSsl)
|
||||
.put("request.headers.X-Found-Cluster", clusterId)
|
||||
.put("xpack.security.user", "elastic:ypRPLpSMYrEQ5Pm5HL6zePWD")
|
||||
.put("xpack.security.transport.ssl.verification_mode", "full")
|
||||
.build();
|
||||
|
||||
Settings esSettings = Settings.builder().put("cluster.name", EsClusterName).put("node.name", EsNodeName)
|
||||
.build();
|
||||
|
||||
client = new PreBuiltTransportClient(esSettings);
|
||||
return client.addTransportAddress(new TransportAddress(InetAddress.getByName(EsHost), EsPort));
|
||||
String hostname = clusterId + "." + region + ".aws.cloud.es.io";
|
||||
// Instantiate a TransportClient and add the cluster to the list of addresses to connect to.
|
||||
// Only port 9343 (SSL-encrypted) is currently supported.
|
||||
TransportClient client = null;
|
||||
try {
|
||||
client = new PreBuiltXPackTransportClient(settings)
|
||||
.addTransportAddress(new TransportAddress(InetAddress.getByName(hostname), 9343));
|
||||
} catch (UnknownHostException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -1,12 +1,12 @@
|
||||
server.servlet.context-path=/arjion
|
||||
server.port=8080
|
||||
elasticsearch.clustername=elasticsearch
|
||||
elasticsearch.host=localhost
|
||||
elasticsearch.port=9300
|
||||
server.port=3117
|
||||
elasticsearch.clustername=2be3ffc1fd284a8788906e5022d0cb18
|
||||
elasticsearch.host=2be3ffc1fd284a8788906e5022d0cb18.eu-central-1.aws.cloud.es.io
|
||||
elasticsearch.port=9343
|
||||
elasticsearch.nodename=arjion
|
||||
arjion.indexName=documentos
|
||||
arjion.documentType=documento
|
||||
arjion.uploadpath=/upload/
|
||||
arjion.uploadpath=/home/ale/upload/
|
||||
arjion.tesseractpath=/usr/bin
|
||||
arjion.tesseractdatapath=/usr/share/tesseract-ocr
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
|
Loading…
Reference in New Issue
Block a user