[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 <[email protected]>
Authored: Fri Sep 8 09:00:25 2017 +0900
Committer: Shinsuke Sugaya <[email protected]>
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
       }
     }

Reply via email to