簡體   English   中英

如何將 SearchResponse 轉換為 JsValue

[英]How to convert SearchResponse to JsValue

我想知道是否有一些直接的方法可以將com.sksamuel.elastic4s.http.search.SearchResponse轉換為play.api.libs.json.JsValue

我看到SearchResponseSearchHit可以通過方法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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM