Commit 0ac13815 authored by 赵威's avatar 赵威

add includes

parent 877856da
...@@ -57,6 +57,7 @@ object ES { ...@@ -57,6 +57,7 @@ object ES {
implicit object ContentHitReader extends HitReader[Content] { implicit object ContentHitReader extends HitReader[Content] {
override def read(hit: Hit): Try[Content] = { override def read(hit: Hit): Try[Content] = {
val source = hit.sourceAsMap val source = hit.sourceAsMap
println(source)
val serviceId = source.get("service.id").asInstanceOf[Some[Long]] val serviceId = source.get("service.id").asInstanceOf[Some[Long]]
Try( Try(
Content(source("id").toString.toLong, hit.index, serviceId, source("tags_v3").toString) Content(source("id").toString.toLong, hit.index, serviceId, source("tags_v3").toString)
...@@ -68,7 +69,9 @@ object ES { ...@@ -68,7 +69,9 @@ object ES {
def request(req: SearchRequest): Either[Throwable, Future[IndexedSeq[Content]]] = { def request(req: SearchRequest): Either[Throwable, Future[IndexedSeq[Content]]] = {
val client: ElasticClient = ESClient.create("172.16.52.33", 9200, "elastic", "gengmei!@#") val client: ElasticClient = ESClient.create("172.16.52.33", 9200, "elastic", "gengmei!@#")
// println(req.show) println("!!!!!!!!!!!!!!")
println(req.show)
println("!!!!!!!!!!!!!!")
println("@@@@@@@@@@@@@") println("@@@@@@@@@@@@@")
client.execute(req).map { resp => client.execute(req).map { resp =>
val a = resp.result.to[Content] val a = resp.result.to[Content]
...@@ -358,7 +361,7 @@ object ES { ...@@ -358,7 +361,7 @@ object ES {
cityId: Int = -1, cityId: Int = -1,
size: Int = 100 size: Int = 100
): SearchRequest = { ): SearchRequest = {
val includes = List("id", "tags_v3") val includes = List("id", "tags_v3", "service")
var shouldListBuffer: ListBuffer[Query] = ListBuffer.empty[Query] var shouldListBuffer: ListBuffer[Query] = ListBuffer.empty[Query]
val mustNotListBuffer: ListBuffer[Query] = ListBuffer.empty[Query] val mustNotListBuffer: ListBuffer[Query] = ListBuffer.empty[Query]
mustNotListBuffer += termQuery("show_by_index", 2) mustNotListBuffer += termQuery("show_by_index", 2)
......
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