Skip to content

Commit

Permalink
Refactor HttpElasticExecutor methods (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbulaja98 authored Jan 16, 2023
1 parent 9a4fff3 commit 340fcf7
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC
}

def executeDeleteByQuery(r: DeleteByQueryRequest): Task[DeletionOutcome] = {
val uri = uri"${config.uri}/${IndexName.unwrap(r.index)}/_delete_by_query".withParam("refresh", r.refresh.toString)
val uri = uri"${config.uri}/${r.index}/$DeleteByQuery".withParam("refresh", r.refresh.toString)

sendRequest(
request
Expand Down Expand Up @@ -180,7 +180,7 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC
private def executeGetByQuery(r: GetByQueryRequest): Task[ElasticQueryResponse] =
sendRequestWithCustomResponse(
request
.post(uri"${config.uri}/${r.index}/_search")
.post(uri"${config.uri}/${r.index}/$Search")
.response(asJson[ElasticQueryResponse])
.contentType(ApplicationJson)
.body(r.query.toJsonBody)
Expand Down Expand Up @@ -230,8 +230,10 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC

private[elasticsearch] object HttpElasticExecutor {

private final val Doc = "_doc"
private final val Create = "_create"
private final val Doc = "_doc"
private final val Create = "_create"
private final val DeleteByQuery = "_delete_by_query"
private final val Search = "_search"

def apply(config: ElasticConfig, client: SttpBackend[Task, Any]) =
new HttpElasticExecutor(config, client)
Expand Down

0 comments on commit 340fcf7

Please sign in to comment.