From b9cd5bee4a44548d87ea24ee766a59882f399079 Mon Sep 17 00:00:00 2001 From: To-om Date: Thu, 15 Apr 2021 08:07:46 +0200 Subject: [PATCH] #1964 Renew global index only if ElasticSearch is used --- .../org/thp/thehive/models/TheHiveSchemaDefinition.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala b/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala index 492ceca462..a910840f40 100644 --- a/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala +++ b/thehive/app/org/thp/thehive/models/TheHiveSchemaDefinition.scala @@ -471,7 +471,12 @@ class TheHiveSchemaDefinition @Inject() extends Schema with UpdatableSchema { .removeIndex("Tag", IndexType.standard) .removeIndex("Task", IndexType.standard) //=====[release 4.1.3]===== - .removeIndex("global", IndexType.fulltext) + .dbOperation[JanusDatabase]("Remove global index if ElasticSearch is used") { db => + db.managementTransaction(mgmt => Try(mgmt.get("index.search.backend"))).flatMap { + case "elasticsearch" => db.removeIndex("global", IndexType.fulltext, Nil) + case _ => Success(()) + } + } .updateGraph("Add manageProcedure permission to org-admin and analyst profiles", "Profile") { traversal => traversal .unsafeHas("name", P.within("org-admin", "analyst"))