diff --git a/pom.xml b/pom.xml
index 13ae99d71..5f200272f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,12 +203,12 @@
org.elasticsearch
elasticsearch
- 5.3.0
+ 2.3.0
com.sksamuel.elastic4s
- elastic4s-tcp_2.11
- 5.3.0
+ elastic4s-core_2.11
+ 2.3.0
diff --git a/src/main/resources/props/sample.props.template b/src/main/resources/props/sample.props.template
index 0fe8c37da..9b606a3cc 100644
--- a/src/main/resources/props/sample.props.template
+++ b/src/main/resources/props/sample.props.template
@@ -55,7 +55,6 @@ write_metrics=true
#allow_elasticsearch=true
#allow_elasticsearch_warehouse=true
#allow_elasticsearch_metrics=true
-#es.cluster.name=elasticsearch
## ElasticSearch warehouse
#es.warehouse.index=warehouse
diff --git a/src/main/scala/code/api/openidconnect.scala b/src/main/scala/code/api/openidconnect.scala
index 30bb8b189..6fbe70772 100644
--- a/src/main/scala/code/api/openidconnect.scala
+++ b/src/main/scala/code/api/openidconnect.scala
@@ -214,7 +214,7 @@ object OpenIdConnect extends OBPRestHelper with Loggable {
connection.getOutputStream.write(dataBytes)
}
val inputStream = connection.getInputStream
- content = scala.io.Source.fromInputStream(inputStream).mkString
+ content = io.Source.fromInputStream(inputStream).mkString
if (inputStream != null) inputStream.close()
} catch {
case e:Throwable => println(e)
diff --git a/src/main/scala/code/search/search.scala b/src/main/scala/code/search/search.scala
index cd789d822..2da401f64 100644
--- a/src/main/scala/code/search/search.scala
+++ b/src/main/scala/code/search/search.scala
@@ -1,5 +1,7 @@
package code.search
+import com.sksamuel.elastic4s.ElasticClient
+import com.sksamuel.elastic4s.ElasticDsl._
import dispatch.{Http, url}
import net.liftweb.common.Loggable
@@ -14,11 +16,7 @@ import Defaults._
import net.liftweb.json
import java.util.Date
-import org.elasticsearch.common.settings.Settings
-import com.sksamuel.elastic4s.TcpClient
-import com.sksamuel.elastic4s.mappings.FieldType._
-import com.sksamuel.elastic4s.ElasticDsl._
-
+import com.sksamuel.elastic4s.mappings.FieldType.{DateType, StringType}
import net.liftweb.http.provider.HTTPCookie
import net.liftweb.json.JsonAST
@@ -135,21 +133,19 @@ class elasticsearchMetrics extends elasticsearch {
if (esIndex.contains(",")) throw new RuntimeException("Props error: es.metrics.index can not be a list")
- var client:TcpClient = null
-
+ var client:ElasticClient = null
if (Props.getBool("allow_elasticsearch", false) && Props.getBool("allow_elasticsearch_metrics", false) ) {
- val settings = Settings.builder().put("cluster.name", Props.get("es.cluster.name", "elasticsearch")).build()
- client = TcpClient.transport(settings, "elasticsearch://" + esHost + ":" + esPortTCP + ",")
+ client = ElasticClient.transport("elasticsearch://" + esHost + ":" + esPortTCP + ",")
try {
client.execute {
- createIndex(esIndex).mappings(
- mapping("request") as (
- textField("userId"),
- textField("url"),
- dateField("date"),
- textField("userName"),
- textField("appName"),
- textField("developerEmail")
+ create index esIndex mappings (
+ "request" as (
+ "userId" typed StringType,
+ "url" typed StringType,
+ "date" typed DateType,
+ "userName" typed StringType,
+ "appName" typed StringType,
+ "developerEmail" typed StringType
)
)
}
@@ -163,7 +159,7 @@ class elasticsearchMetrics extends elasticsearch {
if (Props.getBool("allow_elasticsearch", false) && Props.getBool("allow_elasticsearch_metrics", false) ) {
try {
client.execute {
- indexInto(esIndex / "request") fields (
+ index into esIndex / "request" fields (
"userId" -> userId,
"url" -> url,
"date" -> date,
@@ -187,10 +183,9 @@ class elasticsearchWarehouse extends elasticsearch {
override val esPortTCP = Props.get("es.warehouse.port.tcp","9300")
override val esPortHTTP = Props.get("es.warehouse.port.http","9200")
override val esIndex = Props.get("es.warehouse.index", "warehouse")
- var client:TcpClient = null
+ var client:ElasticClient = null
if (Props.getBool("allow_elasticsearch", false) && Props.getBool("allow_elasticsearch_warehouse", false) ) {
- val settings = Settings.builder().put("cluster.name", Props.get("es.cluster.name", "elasticsearch")).build()
- client = TcpClient.transport(settings, "elasticsearch://" + esHost + ":" + esPortTCP + ",")
+ client = ElasticClient.transport("elasticsearch://" + esHost + ":" + esPortTCP + ",")
}
}
@@ -203,10 +198,10 @@ class elasticsearchOBP extends elasticsearch {
val accountIndex = "account_v1.2.1"
val transactionIndex = "transaction_v1.2.1"
- var client:TcpClient = null
+ var client:ElasticClient = null
if (Props.getBool("allow_elasticsearch", false) ) {
- client = TcpClient.transport("elasticsearch://" + esHost + ":" + esPortTCP + ",")
+ client = ElasticClient.transport("elasticsearch://" + esHost + ":" + esPortTCP + ",")
client.execute {
create index accountIndex mappings (