Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Another fix for ESClient to update aliases correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mars committed May 19, 2017
1 parent 302c753 commit 2113992
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/main/scala/EsClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ object EsClient {
"HEAD",
s"/$indexName",
Map.empty[String, String].asJava).getStatusLine.getStatusCode match {
case 404 =>
logger.warn("Elasticsearch index: $indexName wasn't deleted because it didn't exist. This may be an error.")
false
case 404 => false
case 200 =>
restClient.performRequest(
"DELETE",
Expand Down Expand Up @@ -265,14 +263,6 @@ object EsClient {
| ]
|}""".stripMargin.replace("\n", "")
val entity = new NStringEntity(aliasQuery, ContentType.APPLICATION_JSON)
if (!oldIndexSet.isEmpty) {
restClient.performRequest(
"HEAD",
s"/${alias}",
Map.empty[String, String].asJava).getStatusLine.getStatusCode match {
case 200 => deleteIndex(alias)
}
}
restClient.performRequest(
"POST",
"/_aliases",
Expand Down

0 comments on commit 2113992

Please sign in to comment.