You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by ch...@apache.org on 2017/09/28 15:55:27 UTC
[46/57] [abbrv] incubator-predictionio git commit: [PIO-117] Cannot
delete event data on ESLEvents
[PIO-117] Cannot delete event data on ESLEvents
Closes #428
Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/6cf89c50
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/6cf89c50
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/6cf89c50
Branch: refs/heads/livedoc
Commit: 6cf89c50252988bf3b2007c82d666b4205a98beb
Parents: 8dcd948
Author: Shinsuke Sugaya <sh...@apache.org>
Authored: Fri Sep 8 09:00:25 2017 +0900
Committer: Shinsuke Sugaya <sh...@apache.org>
Committed: Fri Sep 8 09:00:25 2017 +0900
----------------------------------------------------------------------
.../data/storage/elasticsearch/ESLEvents.scala | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/6cf89c50/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
----------------------------------------------------------------------
diff --git a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
index 5e1f4c1..185be92 100644
--- a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
+++ b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
@@ -287,16 +287,10 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
Map("refresh" -> ESUtils.getEventDataRefresh(config)).asJava,
entity)
val jsonResponse = parse(EntityUtils.toString(response.getEntity))
- val result = (jsonResponse \ "result").extract[String]
- result match {
- case "deleted" => true
- case _ =>
- error(s"[$result] Failed to update $index/$estype:$eventId")
- false
- }
+ (jsonResponse \ "deleted").extract[Int] > 0
} catch {
case e: IOException =>
- error(s"Failed to update $index/$estype:$eventId", e)
+ error(s"Failed to delete $index/$estype:$eventId", e)
false
}
}