This is an automated email from the ASF dual-hosted git repository.
markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new be89eb7 Allow ElasticSearchClient to retrieve hit count. (#3794)
be89eb7 is described below
commit be89eb7f0b8d2d215e9b5bf28d6eab8618cfb2d5
Author: James Dubee <[email protected]>
AuthorDate: Tue Jul 3 15:22:59 2018 -0400
Allow ElasticSearchClient to retrieve hit count. (#3794)
---
.../whisk/core/containerpool/logging/ElasticSearchRestClient.scala | 4 ++--
.../core/containerpool/logging/ElasticSearchRestClientTests.scala | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git
a/common/scala/src/main/scala/whisk/core/containerpool/logging/ElasticSearchRestClient.scala
b/common/scala/src/main/scala/whisk/core/containerpool/logging/ElasticSearchRestClient.scala
index 1597ecc..60a9b49 100644
---
a/common/scala/src/main/scala/whisk/core/containerpool/logging/ElasticSearchRestClient.scala
+++
b/common/scala/src/main/scala/whisk/core/containerpool/logging/ElasticSearchRestClient.scala
@@ -70,7 +70,7 @@ case class EsQuery(query: EsQueryMethod,
// Schema of ES query results
case class EsSearchHit(source: JsObject)
-case class EsSearchHits(hits: Vector[EsSearchHit])
+case class EsSearchHits(hits: Vector[EsSearchHit], total: Int)
case class EsSearchResult(hits: EsSearchHits)
object ElasticSearchJsonProtocol extends DefaultJsonProtocol {
@@ -148,7 +148,7 @@ object ElasticSearchJsonProtocol extends
DefaultJsonProtocol {
implicit val esQueryFormat = jsonFormat4(EsQuery.apply)
implicit val esSearchHitFormat = jsonFormat(EsSearchHit.apply _, "_source")
- implicit val esSearchHitsFormat = jsonFormat1(EsSearchHits.apply)
+ implicit val esSearchHitsFormat = jsonFormat2(EsSearchHits.apply)
implicit val esSearchResultFormat = jsonFormat1(EsSearchResult.apply)
}
diff --git
a/tests/src/test/scala/whisk/core/containerpool/logging/ElasticSearchRestClientTests.scala
b/tests/src/test/scala/whisk/core/containerpool/logging/ElasticSearchRestClientTests.scala
index 74eccdf..9617ba9 100644
---
a/tests/src/test/scala/whisk/core/containerpool/logging/ElasticSearchRestClientTests.scala
+++
b/tests/src/test/scala/whisk/core/containerpool/logging/ElasticSearchRestClientTests.scala
@@ -185,6 +185,7 @@ class ElasticSearchRestClientTests
response shouldBe 'right
response.right.get.hits.hits should have size 1
+ response.right.get.hits.total shouldBe 1375
response.right.get.hits.hits(0).source shouldBe
defaultResponseSource.parseJson.asJsObject
}