Commit 589759b8 authored by 赵威's avatar 赵威

add logger

parent 0ac13815
package com.gmei.up.utils
case class Content(id: Long, index: String, serviceId: Some[Long], projects: String)
case class Content(id: Long, index: String, serviceId: Option[Long], projects: String)
......@@ -58,7 +58,7 @@ object ES {
override def read(hit: Hit): Try[Content] = {
val source = hit.sourceAsMap
println(source)
val serviceId = source.get("service.id").asInstanceOf[Some[Long]]
val serviceId = source.getOrElse("service", Map[String, Long]()).asInstanceOf[Map[String, Long]].get("id")
Try(
Content(source("id").toString.toLong, hit.index, serviceId, source("tags_v3").toString)
)
......@@ -69,9 +69,6 @@ object ES {
def request(req: SearchRequest): Either[Throwable, Future[IndexedSeq[Content]]] = {
val client: ElasticClient = ESClient.create("172.16.52.33", 9200, "elastic", "gengmei!@#")
println("!!!!!!!!!!!!!!")
println(req.show)
println("!!!!!!!!!!!!!!")
println("@@@@@@@@@@@@@")
client.execute(req).map { resp =>
val a = resp.result.to[Content]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment