[英]How to convert SearchResponse to JsValue
我想知道是否有一些直接的方法可以將com.sksamuel.elastic4s.http.search.SearchResponse
轉換為play.api.libs.json.JsValue
。
我看到SearchResponse
的SearchHit
可以通過方法sourceAsString
轉換為 JSON String 。
但我需要SearchResponse
一些信息,例如總點擊次數。
x is Response[SearchResponse]
val s = x.result.hits.hits.map(x => x.sourceAsString)
// hit count
val totalCount = x.result.hits.total
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.