@@ -38,7 +38,7 @@ import org.json4s.ext.JodaTimeSerializers
38
38
import grizzled .slf4j .Logging
39
39
import org .apache .http .message .BasicHeader
40
40
41
- class ESLEvents (val client : RestClient , config : StorageClientConfig , val index : String )
41
+ class ESLEvents (val client : RestClient , config : StorageClientConfig , val baseIndex : String )
42
42
extends LEvents with Logging {
43
43
implicit val formats = DefaultFormats .lossless ++ JodaTimeSerializers .all
44
44
@@ -52,6 +52,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
52
52
53
53
override def init (appId : Int , channelId : Option [Int ] = None ): Boolean = {
54
54
val estype = getEsType(appId, channelId)
55
+ val index = baseIndex + " _" + estype
55
56
ESUtils .createIndex(client, index,
56
57
ESUtils .getNumberOfShards(config, index.toUpperCase),
57
58
ESUtils .getNumberOfReplicas(config, index.toUpperCase))
@@ -77,6 +78,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
77
78
78
79
override def remove (appId : Int , channelId : Option [Int ] = None ): Boolean = {
79
80
val estype = getEsType(appId, channelId)
81
+ val index = baseIndex + " _" + estype
80
82
try {
81
83
val json =
82
84
(" query" ->
@@ -107,6 +109,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
107
109
channelId : Option [Int ])(implicit ec : ExecutionContext ): Future [String ] = {
108
110
Future {
109
111
val estype = getEsType(appId, channelId)
112
+ val index = baseIndex + " _" + estype
110
113
try {
111
114
val id = event.eventId.getOrElse {
112
115
ESEventsUtil .getBase64UUID
@@ -152,6 +155,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
152
155
channelId : Option [Int ])(implicit ec : ExecutionContext ): Future [Seq [String ]] = {
153
156
Future {
154
157
val estype = getEsType(appId, channelId)
158
+ val index = baseIndex + " _" + estype
155
159
try {
156
160
val ids = events.map { event =>
157
161
event.eventId.getOrElse(ESEventsUtil .getBase64UUID)
@@ -214,6 +218,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
214
218
}
215
219
216
220
private def exists (client : RestClient , estype : String , id : Int ): Boolean = {
221
+ val index = baseIndex + " _" + estype
217
222
try {
218
223
client.performRequest(
219
224
" GET" ,
@@ -242,6 +247,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
242
247
channelId : Option [Int ])(implicit ec : ExecutionContext ): Future [Option [Event ]] = {
243
248
Future {
244
249
val estype = getEsType(appId, channelId)
250
+ val index = baseIndex + " _" + estype
245
251
try {
246
252
val json =
247
253
(" query" ->
@@ -275,6 +281,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
275
281
channelId : Option [Int ])(implicit ec : ExecutionContext ): Future [Boolean ] = {
276
282
Future {
277
283
val estype = getEsType(appId, channelId)
284
+ val index = baseIndex + " _" + estype
278
285
try {
279
286
val json =
280
287
(" query" ->
@@ -311,6 +318,7 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
311
318
(implicit ec : ExecutionContext ): Future [Iterator [Event ]] = {
312
319
Future {
313
320
val estype = getEsType(appId, channelId)
321
+ val index = baseIndex + " _" + estype
314
322
try {
315
323
val query = ESUtils .createEventQuery(
316
324
startTime, untilTime, entityType, entityId,
0 commit comments