Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(executor): Refactor HttpElasticExecutor methods #41

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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