Skip to content

Commit

Permalink
Rename remove index to delete index
Browse files Browse the repository at this point in the history
  • Loading branch information
markaya authored and drmarjanovic committed Nov 30, 2022
1 parent c67bcb2 commit 72cb2fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object ElasticRequest {
definition: Option[String]
): ElasticRequest[Unit] = CreateIndex(name, definition)

def removeIndex(name: IndexName): ElasticRequest[Unit] = RemoveIndex(name)
def deleteIndex(name: IndexName): ElasticRequest[Unit] = DeleteIndex(name)

private[elasticsearch] final case class Create(
index: IndexName,
Expand Down Expand Up @@ -82,12 +82,10 @@ object ElasticRequest {
routing: Option[Routing] = None
) extends ElasticRequest[Option[Document]]

<<<<<<< HEAD
private[elasticsearch] final case class CreateIndex(name: IndexName, definition: Option[String])
extends ElasticRequest[Unit]
=======
private[elasticsearch] final case class RemoveIndex(name: IndexName) extends ElasticRequest[Unit]
>>>>>>> 99ffeca (Add removing index)

private[elasticsearch] final case class DeleteIndex(name: IndexName) extends ElasticRequest[Unit]

private[elasticsearch] final case class Map[A, B](request: ElasticRequest[A], mapper: A => B)
extends ElasticRequest[B]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC
case r: Create => executeCreate(r)
case r: CreateIndex => executeCreateIndex(r)
case r: CreateOrUpdate => executeCreateOrUpdate(r)
case r: DeleteIndex => executeDeleteIndex(r)
case r: Exists => executeExists(r)
case r: GetById => executeGetById(r)
case r: RemoveIndex => executeRemoveIndex(r)
case map @ Map(_, _) => execute(map.request).map(map.mapper)
}

Expand Down Expand Up @@ -83,11 +83,9 @@ private[elasticsearch] final class HttpElasticExecutor private (config: ElasticC
.map(_.code.equals(Ok))
}

private def executeRemoveIndex(r: RemoveIndex): Task[Unit] =
request.delete(uri"$basePath/${r.name}").send(client).map { response =>
println(response)
println(response.body)
}
private def executeDeleteIndex(r: DeleteIndex): Task[Unit] =
request.delete(uri"$basePath/${r.name}").send(client).unit

}

private[elasticsearch] object HttpElasticExecutor {
Expand Down

0 comments on commit 72cb2fa

Please sign in to comment.