Skip to content

Commit

Permalink
Add routing param
Browse files Browse the repository at this point in the history
  • Loading branch information
dbulaja98 authored and drmarjanovic committed Nov 30, 2022
1 parent 0279f8a commit 3952660
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ object ElasticRequest {

private[elasticsearch] final case class Exists(
index: IndexName,
id: DocumentId
id: DocumentId,
routing: Option[Routing] = None
) extends ElasticRequest[Boolean]

private[elasticsearch] final case class GetById(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC
.unit
}

private def executeExists(r: Exists): Task[Boolean] =
private def executeExists(r: Exists): Task[Boolean] = {
val uri = uri"$basePath/${r.index}/$Doc/${r.id}".withParam("routing", r.routing.map(_.value))
request
.get(uri"$basePath/${r.index}/$Doc/${r.id}")
.response(asJson[ElasticGetResponse])
.head(uri)
.send(client)
.map(_.code.equals(Ok))
}

}

Expand Down

0 comments on commit 3952660

Please sign in to comment.