[
https://issues.apache.org/jira/browse/PIO-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664048#comment-16664048
]
ASF GitHub Bot commented on PIO-189:
------------------------------------
EmergentOrder closed pull request #488: [PIO-189] fix ES6 integration test
URL: https://github.com/apache/predictionio/pull/488
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 185be9281..f275ec921 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
@@ -38,7 +38,7 @@ import org.json4s.ext.JodaTimeSerializers
import grizzled.slf4j.Logging
import org.apache.http.message.BasicHeader
-class ESLEvents(val client: RestClient, config: StorageClientConfig, val
index: String)
+class ESLEvents(val client: RestClient, config: StorageClientConfig, val
baseIndex: String)
extends LEvents with Logging {
implicit val formats = DefaultFormats.lossless ++ JodaTimeSerializers.all
@@ -52,6 +52,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
override def init(appId: Int, channelId: Option[Int] = None): Boolean = {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
ESUtils.createIndex(client, index,
ESUtils.getNumberOfShards(config, index.toUpperCase),
ESUtils.getNumberOfReplicas(config, index.toUpperCase))
@@ -77,6 +78,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
override def remove(appId: Int, channelId: Option[Int] = None): Boolean = {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val json =
("query" ->
@@ -107,6 +109,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
channelId: Option[Int])(implicit ec: ExecutionContext): Future[String] = {
Future {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val id = event.eventId.getOrElse {
ESEventsUtil.getBase64UUID
@@ -152,6 +155,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
channelId: Option[Int])(implicit ec: ExecutionContext):
Future[Seq[String]] = {
Future {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val ids = events.map { event =>
event.eventId.getOrElse(ESEventsUtil.getBase64UUID)
@@ -214,6 +218,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
}
private def exists(client: RestClient, estype: String, id: Int): Boolean = {
+ val index = baseIndex + "_" + estype
try {
client.performRequest(
"GET",
@@ -242,6 +247,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
channelId: Option[Int])(implicit ec: ExecutionContext):
Future[Option[Event]] = {
Future {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val json =
("query" ->
@@ -275,6 +281,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
channelId: Option[Int])(implicit ec: ExecutionContext): Future[Boolean] = {
Future {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val json =
("query" ->
@@ -311,6 +318,7 @@ class ESLEvents(val client: RestClient, config:
StorageClientConfig, val index:
(implicit ec: ExecutionContext): Future[Iterator[Event]] = {
Future {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
try {
val query = ESUtils.createEventQuery(
startTime, untilTime, entityType, entityId,
diff --git
a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESPEvents.scala
b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESPEvents.scala
index 75f7639c5..a86d37833 100644
---
a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESPEvents.scala
+++
b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESPEvents.scala
@@ -41,7 +41,7 @@ import org.json4s.native.JsonMethods._
import org.json4s.ext.JodaTimeSerializers
-class ESPEvents(client: RestClient, config: StorageClientConfig, index: String)
+class ESPEvents(client: RestClient, config: StorageClientConfig, baseIndex:
String)
extends PEvents {
implicit val formats = DefaultFormats.lossless ++ JodaTimeSerializers.all
@@ -78,6 +78,7 @@ class ESPEvents(client: RestClient, config:
StorageClientConfig, index: String)
eventNames, targetEntityType, targetEntityId, None)
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
val conf = new Configuration()
conf.set("es.resource", s"$index/$estype")
conf.set("es.query", query)
@@ -97,6 +98,7 @@ class ESPEvents(client: RestClient, config:
StorageClientConfig, index: String)
events: RDD[Event],
appId: Int, channelId: Option[Int])(sc: SparkContext): Unit = {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
val conf = Map("es.resource" -> s"$index/$estype", "es.nodes" ->
getESNodes())
events.map { event =>
ESEventsUtil.eventToPut(event, appId)
@@ -107,6 +109,7 @@ class ESPEvents(client: RestClient, config:
StorageClientConfig, index: String)
eventIds: RDD[String],
appId: Int, channelId: Option[Int])(sc: SparkContext): Unit = {
val estype = getEsType(appId, channelId)
+ val index = baseIndex + "_" + estype
eventIds.foreachPartition { iter =>
iter.foreach { eventId =>
try {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> ES6 integration test fails
> --------------------------
>
> Key: PIO-189
> URL: https://issues.apache.org/jira/browse/PIO-189
> Project: PredictionIO
> Issue Type: Sub-task
> Reporter: Takako Shimamoto
> Priority: Major
>
> ES6 integration test fails when
> PIO_STORAGE_REPOSITORIES_EVENTDATA_SOURCE=ELASTICSEARCH is specified.
> https://travis-ci.org/apache/predictionio/builds/445535291
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)