You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by jk...@apache.org on 2022/07/27 16:54:00 UTC

[unomi] branch migrationTests updated: UNOMI-632: implement migration test for 2.0.0 with coverage on actual migrated data

This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch migrationTests
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/migrationTests by this push:
     new af01ee6c0 UNOMI-632: implement migration test for 2.0.0 with coverage on actual migrated data
af01ee6c0 is described below

commit af01ee6c062f23466700941762ed840d7636fffa
Author: Kevan <ke...@jahia.com>
AuthorDate: Wed Jul 27 18:53:38 2022 +0200

    UNOMI-632: implement migration test for 2.0.0 with coverage on actual migrated data
---
 itests/pom.xml                                     |  24 +++
 .../test/java/org/apache/unomi/itests/AllITs.java  |   2 +
 .../test/java/org/apache/unomi/itests/BaseIT.java  |  66 +++++--
 .../test/java/org/apache/unomi/itests/BasicIT.java |   8 -
 .../apache/unomi/itests/ConditionEvaluatorIT.java  |   5 -
 .../org/apache/unomi/itests/ContextServletIT.java  |  28 ---
 .../unomi/itests/CopyPropertiesActionIT.java       |   7 -
 .../org/apache/unomi/itests/EventServiceIT.java    |   8 -
 .../unomi/itests/GroovyActionsServiceIT.java       |  16 --
 .../apache/unomi/itests/IncrementPropertyIT.java   |  16 --
 .../org/apache/unomi/itests/InputValidationIT.java |   8 -
 .../java/org/apache/unomi/itests/JSONSchemaIT.java |   8 -
 .../org/apache/unomi/itests/ModifyConsentIT.java   |   8 -
 .../test/java/org/apache/unomi/itests/PatchIT.java |  19 --
 .../org/apache/unomi/itests/ProfileExportIT.java   |   7 -
 .../apache/unomi/itests/ProfileImportActorsIT.java |   7 -
 .../apache/unomi/itests/ProfileImportBasicIT.java  |   5 -
 .../unomi/itests/ProfileImportRankingIT.java       |   7 -
 .../unomi/itests/ProfileImportSurfersIT.java       |   7 -
 .../org/apache/unomi/itests/ProfileMergeIT.java    |  16 --
 .../org/apache/unomi/itests/ProfileServiceIT.java  |  12 --
 .../itests/ProfileServiceWithoutOverwriteIT.java   |  12 --
 .../unomi/itests/PropertiesUpdateActionIT.java     |  10 -
 .../org/apache/unomi/itests/RuleServiceIT.java     |   8 -
 .../test/java/org/apache/unomi/itests/ScopeIT.java |   8 -
 .../java/org/apache/unomi/itests/SegmentIT.java    |  16 --
 .../org/apache/unomi/itests/SendEventActionIT.java |   7 -
 .../apache/unomi/itests/graphql/BaseGraphQLIT.java |   3 -
 .../unomi/itests/graphql/GraphQLEventIT.java       |  12 --
 .../apache/unomi/itests/graphql/GraphQLListIT.java |   4 -
 .../itests/graphql/GraphQLProfileAliasesIT.java    |   4 -
 .../unomi/itests/graphql/GraphQLProfileIT.java     |   4 -
 .../itests/graphql/GraphQLProfilePropertiesIT.java |   4 -
 .../unomi/itests/graphql/GraphQLSegmentIT.java     |   4 -
 .../unomi/itests/graphql/GraphQLSourceIT.java      |   4 -
 .../unomi/itests/graphql/GraphQLTopicIT.java       |   4 -
 .../apache/unomi/itests/graphql/GraphQLViewIT.java |  16 --
 .../unomi/itests/migration/Migrate16xTo200IT.java  | 214 +++++++++++++++++++++
 .../migration/create_snapshots_repository.json     |   6 +
 .../migration}/org.apache.unomi.migration.cfg      |  10 +-
 .../resources/migration/snapshots_repository.zip   | Bin 0 -> 709502 bytes
 .../unomi/shell/migration/impl/MigrationTo200.java |  13 +-
 .../shell/migration/utils/MigrationUtils.java      |  44 ++++-
 .../migrate-2.0.0-01-segmentReindex.groovy         |   4 +-
 .../migrate-2.0.0-02-scoringPlanReindex.groovy     |   4 +-
 .../migrate-2.0.0-03-profileReindex.groovy         |   4 +-
 .../migrate-2.0.0-04-eventsReindex.groovy          |   4 +-
 .../main/resources/org.apache.unomi.migration.cfg  |   6 +-
 .../requestBody/2.0.0/base_index_mapping.json      |  23 +++
 .../resources/requestBody/2.0.0/event_index.json   |  87 ---------
 .../resources/requestBody/2.0.0/profile_index.json |  76 --------
 .../resources/requestBody/2.0.0/scoring_index.json |  68 -------
 .../resources/requestBody/2.0.0/segment_index.json |  64 ------
 .../main/resources/requestBody/scopeMapping.json   |  44 -----
 54 files changed, 374 insertions(+), 701 deletions(-)

diff --git a/itests/pom.xml b/itests/pom.xml
index c808b5c63..fb1799204 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -128,6 +128,12 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.unomi</groupId>
+            <artifactId>shell-commands</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.codehaus.groovy</groupId>
             <artifactId>groovy</artifactId>
@@ -181,6 +187,23 @@
                             </execution>
                         </executions>
                     </plugin>
+                    <plugin>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <version>1.8</version>
+                        <executions>
+                            <execution>
+                                <phase>generate-resources</phase>
+                                <configuration>
+                                    <tasks>
+                                        <unzip src="${project.basedir}/src/test/resources/migration/snapshots_repository.zip" dest="${project.build.directory}" />
+                                    </tasks>
+                                </configuration>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
                     <plugin>
                         <groupId>com.github.alexcojocaru</groupId>
                         <artifactId>elasticsearch-maven-plugin</artifactId>
@@ -198,6 +221,7 @@
                             </environmentVariables>
                             <instanceSettings>
                                 <properties>
+                                    <path.repo>${project.build.directory}/snapshots_repository</path.repo>
                                     <cluster.routing.allocation.disk.threshold_enabled>false</cluster.routing.allocation.disk.threshold_enabled>
                                     <http.cors.allow-origin>*</http.cors.allow-origin>
                                     <http.cors.allow-methods>OPTIONS,HEAD,GET,POST,PUT,DELETE</http.cors.allow-methods>
diff --git a/itests/src/test/java/org/apache/unomi/itests/AllITs.java b/itests/src/test/java/org/apache/unomi/itests/AllITs.java
index c0f858e04..1db16621a 100644
--- a/itests/src/test/java/org/apache/unomi/itests/AllITs.java
+++ b/itests/src/test/java/org/apache/unomi/itests/AllITs.java
@@ -17,6 +17,7 @@
 
 package org.apache.unomi.itests;
 
+import org.apache.unomi.itests.migration.Migrate16xTo200IT;
 import org.apache.unomi.itests.graphql.*;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
@@ -29,6 +30,7 @@ import org.junit.runners.Suite.SuiteClasses;
  */
 @RunWith(Suite.class)
 @SuiteClasses({
+        Migrate16xTo200IT.class,
         BasicIT.class,
         ConditionEvaluatorIT.class,
         ConditionESQueryBuilderIT.class,
diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
index 228b16845..799334e41 100644
--- a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
@@ -46,11 +46,16 @@ import org.apache.karaf.itests.KarafTestSupport;
 import org.apache.unomi.api.Item;
 import org.apache.unomi.api.conditions.Condition;
 import org.apache.unomi.api.rules.Rule;
-import org.apache.unomi.api.services.DefinitionsService;
-import org.apache.unomi.api.services.RulesService;
+import org.apache.unomi.api.services.*;
+import org.apache.unomi.groovy.actions.services.GroovyActionsService;
 import org.apache.unomi.lifecycle.BundleWatcher;
 import org.apache.unomi.persistence.spi.CustomObjectMapper;
 import org.apache.unomi.persistence.spi.PersistenceService;
+import org.apache.unomi.router.api.ExportConfiguration;
+import org.apache.unomi.router.api.ImportConfiguration;
+import org.apache.unomi.router.api.services.ImportExportConfigurationService;
+import org.apache.unomi.schema.api.SchemaService;
+import org.apache.unomi.services.UserListService;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -122,6 +127,7 @@ public abstract class BaseIT extends KarafTestSupport {
     protected static final int DEFAULT_TRYING_TRIES = 30;
 
     protected final static ObjectMapper objectMapper;
+    protected static boolean unomiStarted = false;
 
     static {
         objectMapper = new ObjectMapper();
@@ -130,37 +136,63 @@ public abstract class BaseIT extends KarafTestSupport {
         objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
     }
 
-    @Inject
-    @Filter(timeout = 600000)
     protected PersistenceService persistenceService;
-
-    @Inject
-    @Filter(timeout = 600000)
     protected RulesService rulesService;
-
-    @Inject
-    @Filter(timeout = 600000)
     protected DefinitionsService definitionsService;
+    protected ProfileService profileService;
+    protected EventService eventService;
+    protected BundleWatcher bundleWatcher;
+    protected GroovyActionsService groovyActionsService;
+    protected SegmentService segmentService;
+    protected SchemaService schemaService;
+    protected ScopeService scopeService;
+    protected PatchService patchService;
+    protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
+    protected ImportExportConfigurationService<ExportConfiguration> exportConfigurationService;
+    protected UserListService userListService;
+    protected TopicService topicService;
 
     @Inject
     protected BundleContext bundleContext;
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected BundleWatcher bundleWatcher;
-
     @Inject
     @Filter(timeout = 600000)
     protected ConfigurationAdmin configurationAdmin;
 
-    private CloseableHttpClient httpClient;
+    protected CloseableHttpClient httpClient;
 
     @Before
     public void waitForStartup() throws InterruptedException {
+        if (!unomiStarted) {
+            executeCommand("unomi:start");
+            unomiStarted = true;
+        }
+
+        // Wait for startup complete
+        bundleWatcher = getOsgiService(BundleWatcher.class, 600000);
         while (!bundleWatcher.isStartupComplete() || !bundleWatcher.allAdditionalBundleStarted()) {
             LOGGER.info("Waiting for startup to complete...");
             Thread.sleep(1000);
         }
+
+        // init unomi services that are available once unomi:start have been called
+        persistenceService = getOsgiService(PersistenceService.class, 600000);
+        rulesService = getOsgiService(RulesService.class, 600000);
+        definitionsService = getOsgiService(DefinitionsService.class, 600000);
+        profileService = getOsgiService(ProfileService.class, 600000);
+        eventService = getOsgiService(EventService.class, 600000);
+        groovyActionsService = getOsgiService(GroovyActionsService.class, 600000);
+        segmentService = getOsgiService(SegmentService.class, 600000);
+        schemaService = getOsgiService(SchemaService.class, 600000);
+        scopeService = getOsgiService(ScopeService.class, 600000);
+        patchService = getOsgiService(PatchService.class, 600000);
+        userListService = getOsgiService(UserListService.class, 600000);
+        topicService = getOsgiService(TopicService.class, 600000);
+        patchService = getOsgiService(PatchService.class, 600000);
+        importConfigurationService = getOsgiService(ImportExportConfigurationService.class, "(configDiscriminator=IMPORT)", 600000);
+        exportConfigurationService = getOsgiService(ImportExportConfigurationService.class, "(configDiscriminator=EXPORT)", 600000);
+
+        // init httpClient
         httpClient = initHttpClient();
     }
 
@@ -199,6 +231,8 @@ public abstract class BaseIT extends KarafTestSupport {
         System.out.println("==== Configuring container");
         Option[] options = new Option[]{
                 replaceConfigurationFile("etc/org.apache.unomi.router.cfg", new File("src/test/resources/org.apache.unomi.router.cfg")),
+                replaceConfigurationFile("etc/org.apache.unomi.migration.cfg", new File("src/test/resources/migration/org.apache.unomi.migration.cfg")),
+
                 replaceConfigurationFile("data/tmp/1-basic-test.csv", new File("src/test/resources/1-basic-test.csv")),
                 replaceConfigurationFile("data/tmp/recurrent_import/2-surfers-test.csv", new File("src/test/resources/2-surfers-test.csv")),
                 replaceConfigurationFile("data/tmp/recurrent_import/3-surfers-overwrite-test.csv", new File("src/test/resources/3-surfers-overwrite-test.csv")),
@@ -219,7 +253,6 @@ public abstract class BaseIT extends KarafTestSupport {
                 editConfigurationFilePut("etc/custom.system.properties", "org.apache.unomi.graphql.feature.activated", "true"),
                 editConfigurationFilePut("etc/custom.system.properties", "org.apache.unomi.elasticsearch.cluster.name", "contextElasticSearchITests"),
                 editConfigurationFilePut("etc/custom.system.properties", "org.apache.unomi.elasticsearch.addresses", "localhost:9400"),
-                editConfigurationFilePut("etc/custom.system.properties", "org.apache.unomi.elasticsearch.index.prefix", "itest"),
 
                 systemProperty("org.ops4j.pax.exam.rbc.rmi.port").value("1199"),
                 systemProperty("org.apache.unomi.hazelcast.group.name").value("cellar"),
@@ -227,7 +260,6 @@ public abstract class BaseIT extends KarafTestSupport {
                 systemProperty("org.apache.unomi.hazelcast.network.port").value("5701"),
                 systemProperty("org.apache.unomi.hazelcast.tcp-ip.members").value("127.0.0.1"),
                 systemProperty("org.apache.unomi.hazelcast.tcp-ip.interface").value("127.0.0.1"),
-                systemProperty("unomi.autoStart").value("true"),
 
                 logLevel(LogLevel.INFO),
                 keepRuntimeFolder(),
diff --git a/itests/src/test/java/org/apache/unomi/itests/BasicIT.java b/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
index 8abdf0284..c20a46377 100644
--- a/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
@@ -92,14 +92,6 @@ public class BasicIT extends BaseIT {
     private static final String EMAIL_VISITOR_1 = "visitor1@apache.unomi.org";
     private static final String EMAIL_VISITOR_2 = "visitor2@apache.unomi.org";
 
-    @Inject @Filter(timeout = 600000)
-    protected ProfileService profileService;
-    @Inject @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
-    @Inject @Filter(timeout = 600000)
-    protected ScopeService scopeService;
-
     @Before
     public void setUp() throws InterruptedException {
         TestUtils.createScope(TEST_SCOPE, "Test scope", scopeService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
index c9eb4017a..d74672ca3 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
@@ -50,11 +50,6 @@ public class ConditionEvaluatorIT extends BaseIT {
     protected Item emptyItem;
     protected Date lastVisit;
 
-    @Inject @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-    @Inject @Filter(timeout = 600000)
-    private DefinitionsService definitionsService;
-
     protected boolean eval(Condition c) {
         return persistenceService.testMatch(c, item);
     }
diff --git a/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java b/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
index edc09bb2b..75931756b 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
@@ -93,34 +93,6 @@ public class ContextServletIT extends BaseIT {
     private static final int DEFAULT_TRYING_TRIES = 30;
     public static final String TEST_SCOPE = "test-scope";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected SegmentService segmentService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected SchemaService schemaService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ScopeService scopeService;
-
     private Profile profile;
 
     @Before
diff --git a/itests/src/test/java/org/apache/unomi/itests/CopyPropertiesActionIT.java b/itests/src/test/java/org/apache/unomi/itests/CopyPropertiesActionIT.java
index f74b81223..edbca99ab 100644
--- a/itests/src/test/java/org/apache/unomi/itests/CopyPropertiesActionIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/CopyPropertiesActionIT.java
@@ -64,13 +64,6 @@ public class CopyPropertiesActionIT extends BaseIT {
     public static final String PROPERTY_TO_MAP = "PropertyToMap";
     public static final String MAPPED_PROPERTY = "MappedProperty";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
     @Before
     public void setUp() throws InterruptedException {
         Profile profile = new Profile();
diff --git a/itests/src/test/java/org/apache/unomi/itests/EventServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/EventServiceIT.java
index 06622f50d..4bde047da 100644
--- a/itests/src/test/java/org/apache/unomi/itests/EventServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/EventServiceIT.java
@@ -49,14 +49,6 @@ public class EventServiceIT extends BaseIT {
 
     private final static String TEST_PROFILE_ID = "test-profile-id";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @After
     public void tearDown() {
         TestUtils.removeAllEvents(definitionsService, persistenceService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java
index 9c38e7642..20c507f8d 100644
--- a/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/GroovyActionsServiceIT.java
@@ -55,22 +55,6 @@ public class GroovyActionsServiceIT extends BaseIT {
     public static final String UPDATE_ADDRESS_ACTION_GROOVY_FILE = "data/tmp/groovy/UpdateAddressAction.groovy";
     public static final String UPDATE_ADDRESS_ACTION = "UpdateAddressAction";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected GroovyActionsService groovyActionsService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
     @Before
     public void setUp() throws InterruptedException {
         Profile profile = new Profile();
diff --git a/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java b/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
index 985aed06a..98fe21717 100644
--- a/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
@@ -55,22 +55,6 @@ public class IncrementPropertyIT extends BaseIT {
     private Rule rule;
     private Event event;
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected RulesService rulesService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
     @Before
     public void setup() throws Exception {
         profile = createProfile();
diff --git a/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java b/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
index 8eed7b4c9..8248ca3c7 100644
--- a/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
@@ -61,14 +61,6 @@ public class InputValidationIT extends BaseIT {
     private final static String ERROR_MESSAGE_INVALID_DATA_RECEIVED = "Request rejected by the server because: Invalid received data";
     public static final String DUMMY_SCOPE = "dummy_scope";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected SchemaService schemaService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ScopeService scopeService;
-
     @Before
     public void setUp() throws InterruptedException {
         TestUtils.createScope(DUMMY_SCOPE, "Dummy scope", scopeService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/JSONSchemaIT.java b/itests/src/test/java/org/apache/unomi/itests/JSONSchemaIT.java
index 0bf7b53ae..f30e3f1a6 100644
--- a/itests/src/test/java/org/apache/unomi/itests/JSONSchemaIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/JSONSchemaIT.java
@@ -61,14 +61,6 @@ public class JSONSchemaIT extends BaseIT {
     private static final int DEFAULT_TRYING_TRIES = 30;
     public static final String DUMMY_SCOPE = "dummy_scope";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected SchemaService schemaService;
-
-    @Inject
-    @Filter(timeout = 6000000)
-    protected ScopeService scopeService;
-
     @Before
     public void setUp() throws InterruptedException {
         keepTrying("Couldn't find json schema endpoint", () -> get(JSONSCHEMA_URL, List.class), Objects::nonNull, DEFAULT_TRYING_TIMEOUT,
diff --git a/itests/src/test/java/org/apache/unomi/itests/ModifyConsentIT.java b/itests/src/test/java/org/apache/unomi/itests/ModifyConsentIT.java
index 1deb98cbe..365da464e 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ModifyConsentIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ModifyConsentIT.java
@@ -48,14 +48,6 @@ public class ModifyConsentIT extends BaseIT {
 
     private final static String PROFILE_TEST_ID = "profile-consent";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
     @Before
     public void setUp() throws InterruptedException {
         Profile profile = new Profile();
diff --git a/itests/src/test/java/org/apache/unomi/itests/PatchIT.java b/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
index 181a2eb28..505837175 100644
--- a/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/PatchIT.java
@@ -44,25 +44,6 @@ import java.io.IOException;
 public class PatchIT extends BaseIT {
     private Logger logger = LoggerFactory.getLogger(PatchIT.class);
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected PatchService patchService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
-    @Inject
-    protected BundleContext bundleContext;
-
     @Test
     public void testPatch() throws IOException {
         PropertyType company = profileService.getPropertyType("company");
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileExportIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileExportIT.java
index 82733531c..daa353fa2 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileExportIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileExportIT.java
@@ -49,13 +49,6 @@ import java.util.UUID;
 public class ProfileExportIT extends BaseIT {
     private Logger logger = LoggerFactory.getLogger(ProfileExportIT.class);
 
-    @Inject
-    @Filter(value = "(configDiscriminator=EXPORT)", timeout = 600000)
-    protected ImportExportConfigurationService<ExportConfiguration> exportConfigurationService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testExport() throws InterruptedException {
         Date timestamp = new Date();
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileImportActorsIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileImportActorsIT.java
index bfab6a3cf..f42fbe9ab 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileImportActorsIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileImportActorsIT.java
@@ -48,13 +48,6 @@ import java.util.Objects;
 @ExamReactorStrategy(PerSuite.class)
 public class ProfileImportActorsIT extends BaseIT {
 
-    @Inject
-    @Filter(value = "(configDiscriminator=IMPORT)", timeout = 600000)
-    protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testImportActors() throws InterruptedException {
 
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileImportBasicIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileImportBasicIT.java
index 7f7c7c2a1..cfce7009c 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileImportBasicIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileImportBasicIT.java
@@ -49,11 +49,6 @@ import java.util.Map;
 public class ProfileImportBasicIT extends BaseIT {
     private Logger logger = LoggerFactory.getLogger(ProfileImportBasicIT.class);
 
-    @Inject @Filter(value="(configDiscriminator=IMPORT)", timeout = 600000)
-    protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
-    @Inject @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testImportBasic() throws IOException, InterruptedException {
         /*** Basic Test ***/
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileImportRankingIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileImportRankingIT.java
index 12737e217..2b321b26e 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileImportRankingIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileImportRankingIT.java
@@ -47,13 +47,6 @@ import java.util.Objects;
 @ExamReactorStrategy(PerSuite.class)
 public class ProfileImportRankingIT extends BaseIT {
 
-    @Inject
-    @Filter(value = "(configDiscriminator=IMPORT)", timeout = 600000)
-    protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testImportRanking() throws InterruptedException {
 
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileImportSurfersIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileImportSurfersIT.java
index 4612b2058..e1d478bea 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileImportSurfersIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileImportSurfersIT.java
@@ -50,13 +50,6 @@ import java.util.Objects;
 public class ProfileImportSurfersIT extends BaseIT {
     private Logger logger = LoggerFactory.getLogger(ProfileImportSurfersIT.class);
 
-    @Inject
-    @Filter(value = "(configDiscriminator=IMPORT)", timeout = 600000)
-    protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testImportSurfers() throws InterruptedException {
 
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileMergeIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileMergeIT.java
index ca260ed11..206b21600 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileMergeIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileMergeIT.java
@@ -51,22 +51,6 @@ import java.util.Objects;
 @ExamReactorStrategy(PerSuite.class)
 public class ProfileMergeIT extends BaseIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected RulesService rulesService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
     private final static String TEST_EVENT_TYPE = "mergeProfileTestEventType";
     private final static String TEST_RULE_ID = "mergeOnPropertyTest";
     private final static String TEST_PROFILE_ID = "mergeOnPropertyTestProfileId";
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
index 1340816de..8e38424e8 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
@@ -58,18 +58,6 @@ public class ProfileServiceIT extends BaseIT {
 
     private static final String TEST_PROFILE_ALIAS = "test-profile-alias";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
     @Before
     public void setUp() {
         TestUtils.removeAllProfiles(definitionsService, persistenceService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceWithoutOverwriteIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceWithoutOverwriteIT.java
index 32f442d9c..79e733ca5 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceWithoutOverwriteIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceWithoutOverwriteIT.java
@@ -57,18 +57,6 @@ public class ProfileServiceWithoutOverwriteIT extends BaseIT {
         return options.toArray(new Option[0]);
     }
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
     @Before
     public void setUp() {
         TestUtils.removeAllProfiles(definitionsService, persistenceService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java
index 4628332e2..21d3f9290 100644
--- a/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/PropertiesUpdateActionIT.java
@@ -61,16 +61,6 @@ public class PropertiesUpdateActionIT extends BaseIT {
     private final static String PROFILE_TARGET_TEST_ID = "profile-target-event";
     private final static String PROFILE_TEST_ID = "profile-to-update-by-event";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected RulesService rulesService;
-
     @Before
     public void setUp() throws InterruptedException {
         Profile profile = new Profile();
diff --git a/itests/src/test/java/org/apache/unomi/itests/RuleServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/RuleServiceIT.java
index 2943d073d..aa88cdeb0 100644
--- a/itests/src/test/java/org/apache/unomi/itests/RuleServiceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/RuleServiceIT.java
@@ -55,14 +55,6 @@ public class RuleServiceIT extends BaseIT {
     private final static String TEST_RULE_ID = "test-rule-id";
     public static final String TEST_SCOPE = "test-scope";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected RulesService rulesService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
     @Before
     public void setUp() {
         TestUtils.removeAllProfiles(definitionsService, persistenceService);
diff --git a/itests/src/test/java/org/apache/unomi/itests/ScopeIT.java b/itests/src/test/java/org/apache/unomi/itests/ScopeIT.java
index 39f242f79..11edf0d67 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ScopeIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ScopeIT.java
@@ -50,14 +50,6 @@ public class ScopeIT extends BaseIT {
     private static final int DEFAULT_TRYING_TIMEOUT = 2000;
     private static final int DEFAULT_TRYING_TRIES = 30;
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ScopeService scopeService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
     @Before
     public void setUp() throws InterruptedException {
         keepTrying("Couldn't find scope endpoint", () -> get(SCOPE_URL, List.class), Objects::nonNull, DEFAULT_TRYING_TIMEOUT,
diff --git a/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
index 1eb03718a..b1a3c0626 100644
--- a/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
@@ -58,22 +58,6 @@ public class SegmentIT extends BaseIT {
     private final static Logger LOGGER = LoggerFactory.getLogger(SegmentIT.class);
     private final static String SEGMENT_ID = "test-segment-id-2";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected SegmentService segmentService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
     @Before
     public void setUp() throws InterruptedException {
         removeItems(Segment.class);
diff --git a/itests/src/test/java/org/apache/unomi/itests/SendEventActionIT.java b/itests/src/test/java/org/apache/unomi/itests/SendEventActionIT.java
index bae27b344..3b77dae37 100644
--- a/itests/src/test/java/org/apache/unomi/itests/SendEventActionIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/SendEventActionIT.java
@@ -48,13 +48,6 @@ public class SendEventActionIT extends BaseIT {
     private final static String TEST_EVENT_TYPE = "sendEventTestEventType";
     private final static String TEST_PROFILE_ID = "sendEventTestProfileId";
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
     @After
     public void tearDown() throws InterruptedException {
         eventService.removeProfileEvents(TEST_PROFILE_ID);
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/BaseGraphQLIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/BaseGraphQLIT.java
index f1c4a077a..3f6ab35d8 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/BaseGraphQLIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/BaseGraphQLIT.java
@@ -46,9 +46,6 @@ public abstract class BaseGraphQLIT extends BaseIT {
 
     protected static final ContentType JSON_CONTENT_TYPE = ContentType.create("application/json");
 
-    @Inject
-    protected BundleContext bundleContext;
-
     protected CloseableHttpResponse postAnonymous(final String resource) throws Exception {
         return postAs(resource, null, null);
     }
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLEventIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLEventIT.java
index bd7e0e526..385a4ff57 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLEventIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLEventIT.java
@@ -35,18 +35,6 @@ import java.util.Map;
 
 public class GraphQLEventIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected EventService eventService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected PersistenceService persistenceService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
     private final String profileID = "profile-1";
     private final String eventID = "event-1";
     private Profile profile;
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
index 326d98f35..712ce9037 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLListIT.java
@@ -28,10 +28,6 @@ import java.util.Objects;
 
 public class GraphQLListIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Test
     public void testCRUD() throws Exception {
         Profile persistedProfile = null;
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileAliasesIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileAliasesIT.java
index 6cd62759e..d7defef44 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileAliasesIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileAliasesIT.java
@@ -29,10 +29,6 @@ import javax.inject.Inject;
 
 public class GraphQLProfileAliasesIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Before
     public void setUp() throws InterruptedException {
         removeItems(ProfileAlias.class);
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileIT.java
index 1ea820509..5914ac294 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfileIT.java
@@ -30,10 +30,6 @@ import java.util.Objects;
 
 public class GraphQLProfileIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Before
     public void setUp() throws InterruptedException {
         removeItems(Profile.class);
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfilePropertiesIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfilePropertiesIT.java
index a10853e8d..ea9061443 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfilePropertiesIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLProfilePropertiesIT.java
@@ -39,10 +39,6 @@ import java.util.Objects;
 
 public class GraphQLProfilePropertiesIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     private final static Logger LOGGER = LoggerFactory.getLogger(GraphQLProfilePropertiesIT.class);
 
     @Test
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSegmentIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSegmentIT.java
index 5b6b9f88b..2636733c5 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSegmentIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSegmentIT.java
@@ -33,10 +33,6 @@ import java.util.UUID;
 
 public class GraphQLSegmentIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected ProfileService profileService;
-
     @Before
     public void setUp() throws InterruptedException {
         removeItems(Segment.class);
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSourceIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSourceIT.java
index a1d433135..985ad267d 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSourceIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLSourceIT.java
@@ -28,10 +28,6 @@ import static org.junit.Assert.*;
 
 public class GraphQLSourceIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    ScopeService scopeService;
-
     @Test
     public void testCRUD() throws Exception {
         try (CloseableHttpResponse response = post("graphql/source/create-source.json")) {
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLTopicIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLTopicIT.java
index 954d5c1b4..69c14394a 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLTopicIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLTopicIT.java
@@ -27,10 +27,6 @@ import java.io.IOException;
 
 public class GraphQLTopicIT extends BaseGraphQLIT {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected TopicService topicService;
-
     @Test
     public void testCRUD() throws Exception {
         try (CloseableHttpResponse response = post("graphql/topic/create-topic.json")) {
diff --git a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLViewIT.java b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLViewIT.java
index 5c12b8373..6065b8b29 100644
--- a/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLViewIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/graphql/GraphQLViewIT.java
@@ -40,22 +40,6 @@ public class GraphQLViewIT
     extends BaseGraphQLIT
 {
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected UserListService userListService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected TopicService topicService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected SegmentService segmentService;
-
-    @Inject
-    @Filter(timeout = 600000)
-    protected DefinitionsService definitionsService;
-
     @Test
     public void test()
         throws Exception
diff --git a/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo200IT.java b/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo200IT.java
new file mode 100644
index 000000000..12adf1438
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo200IT.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+package org.apache.unomi.itests.migration;
+
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.unomi.api.*;
+import org.apache.unomi.itests.BaseIT;
+import org.apache.unomi.persistence.spi.aggregate.TermsAggregate;
+import org.apache.unomi.shell.migration.utils.HttpUtils;
+import org.apache.unomi.shell.migration.utils.MigrationUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+public class Migrate16xTo200IT extends BaseIT {
+
+    @Override
+    @Before
+    public void waitForStartup() throws InterruptedException {
+
+        // Restore snapshot from 1.6.x
+        try (CloseableHttpClient httpClient = HttpUtils.initHttpClient(true)) {
+            // Create snapshot repo
+            HttpUtils.executePutRequest(httpClient, "http://localhost:9400/_snapshot/snapshots_repository/", resourceAsString("migration/create_snapshots_repository.json"), null);
+            // Get snapshot, insure it exists
+            String snapshot = HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/_snapshot/snapshots_repository/snapshot_1.6.x", null);
+            if (snapshot == null || !snapshot.contains("snapshot_1.6.x")) {
+                throw new RuntimeException("Unable to retrieve 1.6.x snapshot for ES restore");
+            }
+            // Restore the snapshot
+            HttpUtils.executePostRequest(httpClient, "http://localhost:9400/_snapshot/snapshots_repository/snapshot_1.6.x/_restore?wait_for_completion=true", "{}",  null);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        // Do migrate the data set
+        executeCommand("unomi:migrate 1.6.0 true");
+        // Call super for starting Unomi and wait for the complete startup
+        super.waitForStartup();
+    }
+
+    @After
+    public void cleanup() throws InterruptedException {
+        removeItems(Profile.class);
+        removeItems(Session.class);
+        removeItems(Event.class);
+        removeItems(Scope.class);
+    }
+
+    @Test
+    public void checkMigratedData() throws Exception {
+        checkProfileInterests();
+        checkScopeHaveBeenCreated();
+        checkFormEventRestructured();
+        checkViewEventRestructured();
+        checkEventTypesNotPersistedAnymore();
+        checkForMappingUpdates();
+    }
+
+    /**
+     * Multiple index mappings have been update, check a simple check that after migration those mappings contains the latest modifications.
+     */
+    private void checkForMappingUpdates() throws IOException {
+        Assert.assertTrue(HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/context-scope/_mapping", null).contains("\"match\":\"*\",\"match_mapping_type\":\"string\",\"mapping\":{\"analyzer\":\"folding\""));
+        Assert.assertTrue(HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/context-segment/_mapping", null).contains("\"condition\":{\"type\":\"object\",\"enabled\":false}"));
+        Assert.assertTrue(HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/context-scoring/_mapping", null).contains("\"condition\":{\"type\":\"object\",\"enabled\":false}"));
+        Assert.assertTrue(HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/context-profile/_mapping", null).contains("\"interests\":{\"type\":\"nested\""));
+        for (String eventIndex : MigrationUtils.getIndexesPrefixedBy(httpClient, "http://localhost:9400", "context-event-")) {
+            Assert.assertTrue(HttpUtils.executeGetRequest(httpClient, "http://localhost:9400/" + eventIndex + "/_mapping", null).contains("\"flattenedProperties\":{\"type\":\"flattened\"}"));
+        }
+        // TODO check for campaign, conditionType, goal, patch, rule
+    }
+
+    /**
+     * Data set contains a form event (id: 7b55b4fd-5ff0-4a85-9dc4-ffde322a1de6) with this data:
+     * {
+     *   "properties": {
+     *     "pets": "cat",
+     *     "firstname": "foo",
+     *     "sports": [
+     *       "football",
+     *       "tennis"
+     *     ],
+     *     "city": "Berlin",
+     *     "age": "15",
+     *     "email": "foo@bar.fr",
+     *     "drone": "dewey",
+     *     "lastname": "bar",
+     *     "contactMethod": [
+     *       "postalMethod",
+     *       "phoneMethod"
+     *     ]
+     *   }
+     * }
+     */
+    private void checkFormEventRestructured() {
+        List<Event> events = persistenceService.query("eventType", "form", null, Event.class);
+        for (Event formEvent : events) {
+            Assert.assertEquals(0, formEvent.getProperties().size());
+            Map<String, Object> fields = (Map<String, Object>) formEvent.getFlattenedProperties().get("fields");
+            Assert.assertTrue(fields.size() > 0);
+
+            if (Objects.equals(formEvent.getItemId(), "7b55b4fd-5ff0-4a85-9dc4-ffde322a1de6")) {
+                // check singled valued
+                Assert.assertEquals("cat", fields.get("pets"));
+                // check multi-valued
+                List<String> sports = (List<String>) fields.get("sports");
+                Assert.assertEquals(2, sports.size());
+                Assert.assertTrue(sports.contains("football"));
+                Assert.assertTrue(sports.contains("tennis"));
+            }
+        }
+    }
+
+    /**
+     * Data set contains a view event (id: a4aa836b-c437-48ef-be02-6fbbcba3a1de) with two interests: football:50 and basketball:30
+     * Data set contains a view event (id: 34d53399-f173-451f-8d48-f34f5d9618a9) with two URL Parameters: paramerter_test:value, multiple_paramerter_test:[value1, value2]
+     */
+    private void checkViewEventRestructured() {
+        List<Event> events = persistenceService.query("eventType", "view", null, Event.class);
+        for (Event viewEvent : events) {
+
+            // check interests
+            if (Objects.equals(viewEvent.getItemId(), "a4aa836b-c437-48ef-be02-6fbbcba3a1de")) {
+                CustomItem target = (CustomItem) viewEvent.getTarget();
+                Assert.assertNull(target.getProperties().get("interests"));
+                Map<String, Object> interests = (Map<String, Object>) viewEvent.getFlattenedProperties().get("interests");
+                Assert.assertEquals(30, interests.get("basketball"));
+                Assert.assertEquals(50, interests.get("football"));
+            }
+
+            // check URL parameters
+            if (Objects.equals(viewEvent.getItemId(), "34d53399-f173-451f-8d48-f34f5d9618a9")) {
+                CustomItem target = (CustomItem) viewEvent.getTarget();
+                Map<String, Object> pageInfo = (Map<String, Object>) target.getProperties().get("pageInfo");
+                Assert.assertNull(pageInfo.get("parameters"));
+                Map<String, Object> parameters = (Map<String, Object>) viewEvent.getFlattenedProperties().get("URLParameters");
+                Assert.assertEquals("value", parameters.get("paramerter_test"));
+                List<String> multipleParameterTest = (List<String>) parameters.get("multiple_paramerter_test");
+                Assert.assertEquals(2, multipleParameterTest.size());
+                Assert.assertTrue(multipleParameterTest.contains("value1"));
+                Assert.assertTrue(multipleParameterTest.contains("value2"));
+            }
+        }
+    }
+
+
+    /**
+     * Data set contains 2 events that are not persisted anymore:
+     * One updateProperties event
+     * One sessionCreated event
+     * This test ensures that both have been removed.
+     */
+    private void checkEventTypesNotPersistedAnymore() {
+        Assert.assertEquals(0, persistenceService.query("eventType", "updateProperties", null, Event.class).size());
+        Assert.assertEquals(0, persistenceService.query("eventType", "sessionCreated", null, Event.class).size());
+    }
+
+    /**
+     * Data set contains multiple events, this test is generic enough to ensure all existing events have the scope created correctly
+     * So the data set can contain multiple different scope it's not a problem.
+     */
+    private void checkScopeHaveBeenCreated() {
+        // check that the scope mySite have been created based on the previous existings events
+        Map<String, Long> existingScopesFromEvents = persistenceService.aggregateWithOptimizedQuery(null, new TermsAggregate("scope"), Event.ITEM_TYPE);
+        for (String scopeFromEvents : existingScopesFromEvents.keySet()) {
+            if (!Objects.equals(scopeFromEvents, "_filtered")) {
+                Scope scope = scopeService.getScope(scopeFromEvents);
+                Assert.assertNotNull(scope);
+            }
+        }
+    }
+
+    /**
+     * Data set contains a profile (id: e67ecc69-a7b3-47f1-b91f-5d6e7b90276e) with two interests: football:50 and basketball:30
+     * Also it's first name is test_profile
+     */
+    private void checkProfileInterests() {
+        // check that the test_profile interests have been migrated to new data structure
+        Profile profile = persistenceService.load("e67ecc69-a7b3-47f1-b91f-5d6e7b90276e", Profile.class);
+        Assert.assertEquals("test_profile", profile.getProperty("firstName"));
+
+        List<Map<String, Object>> interests = (List<Map<String, Object>>) profile.getProperty("interests");
+        Assert.assertEquals(2, interests.size());
+        for (Map<String, Object> interest : interests) {
+            if ("basketball".equals(interest.get("key"))) {
+                Assert.assertEquals(30, interest.get("value"));
+            }
+            if ("football".equals(interest.get("key"))) {
+                Assert.assertEquals(50, interest.get("value"));
+            }
+        }
+    }
+}
diff --git a/itests/src/test/resources/migration/create_snapshots_repository.json b/itests/src/test/resources/migration/create_snapshots_repository.json
new file mode 100644
index 000000000..5c80ddb17
--- /dev/null
+++ b/itests/src/test/resources/migration/create_snapshots_repository.json
@@ -0,0 +1,6 @@
+{
+  "type": "fs",
+  "settings": {
+    "location": "snapshots"
+  }
+}
\ No newline at end of file
diff --git a/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg b/itests/src/test/resources/migration/org.apache.unomi.migration.cfg
similarity index 79%
copy from tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg
copy to itests/src/test/resources/migration/org.apache.unomi.migration.cfg
index 8c1a5dc0f..92214cfb1 100644
--- a/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg
+++ b/itests/src/test/resources/migration/org.apache.unomi.migration.cfg
@@ -17,10 +17,6 @@
 
 # Migration config used for silent migration
 
-# esAddress = http://localhost:9200
-# httpClient.trustAllCertificates = true
-# indexPrefix = context
-# number_of_shards = 3
-# number_of_replicas = 0
-# mapping.total_fields.limit = 1000
-# max_docvalue_fields_search = 1000
+esAddress = http://localhost:9400
+httpClient.trustAllCertificates = true
+indexPrefix = context
diff --git a/itests/src/test/resources/migration/snapshots_repository.zip b/itests/src/test/resources/migration/snapshots_repository.zip
new file mode 100644
index 000000000..e0a81a755
Binary files /dev/null and b/itests/src/test/resources/migration/snapshots_repository.zip differ
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo200.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo200.java
index 2dcb74bb9..b1de1815d 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo200.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo200.java
@@ -87,20 +87,15 @@ public class MigrationTo200 implements Migration {
 
         if (scopeIndexNotExists()) {
             System.out.println("Creation for index = \"" + indexPrefix + "-scope\" starting.");
-            System.out.println("Specify the following parameters:");
-            String numberOfShards = migrationConfig.getString(MigrationConfig.NUMBER_OF_SHARDS, session);
-            String numberOfReplicas = migrationConfig.getString(MigrationConfig.NUMBER_OF_REPLICAS, session);
-            String mappingTotalFieldsLimit = migrationConfig.getString(MigrationConfig.TOTAL_FIELDS_LIMIT, session);
-            String maxDocValueFieldsSearch = migrationConfig.getString(MigrationConfig.MAX_DOC_VALUE_FIELDS_SEARCH, session);
-
             final HttpPut httpPost = new HttpPut(esAddress + "/" + indexPrefix + "-scope");
 
             httpPost.addHeader("Accept", "application/json");
             httpPost.addHeader("Content-Type", "application/json");
 
-            String request = MigrationUtils.resourceAsString(bundleContext,"requestBody/scopeMapping.json").replace("$numberOfShards", numberOfShards)
-                    .replace("$numberOfReplicas", numberOfReplicas).replace("$mappingTotalFieldsLimit", mappingTotalFieldsLimit)
-                    .replace("$maxDocValueFieldsSearch", maxDocValueFieldsSearch);
+            String baseRequest = MigrationUtils.resourceAsString(bundleContext,"requestBody/2.0.0/base_index_mapping.json");
+            String mapping = MigrationUtils.extractMappingFromBundles(bundleContext, "scope.json");
+            // We intentionally extract setting from profile index, because the scope index doesnt exist yet, and all indices share the same configuration regarding shards, replicas, etc ..
+            String request = MigrationUtils.buildIndexCreationRequest(httpClient, esAddress, baseRequest, indexPrefix + "-profile", mapping);
 
             httpPost.setEntity(new StringEntity(request));
 
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/MigrationUtils.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/MigrationUtils.java
index 33b0278ed..e93998b50 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/MigrationUtils.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/utils/MigrationUtils.java
@@ -24,6 +24,7 @@ import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
 import org.json.JSONObject;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
 import java.io.BufferedReader;
@@ -34,6 +35,7 @@ import java.io.InputStreamReader;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.Collections;
+import java.util.Enumeration;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -97,17 +99,43 @@ public class MigrationUtils {
         return Collections.emptySet();
     }
 
+    public static String extractMappingFromBundles(BundleContext bundleContext, String fileName) throws IOException {
+        for (Bundle bundle : bundleContext.getBundles()) {
+            Enumeration<URL> predefinedMappings = bundle.findEntries("META-INF/cxs/mappings", fileName, true);
+            if (predefinedMappings == null) {
+                continue;
+            }
+            while (predefinedMappings.hasMoreElements()) {
+                URL predefinedMappingURL = predefinedMappings.nextElement();
+                return IOUtils.toString(predefinedMappingURL);
+            }
+        }
+
+        throw new RuntimeException("no mapping found in bundles for: " + fileName);
+    }
+
+    public static String buildIndexCreationRequest(CloseableHttpClient httpClient, String esAddress, String baseIndexSettings,
+                                            String originalIndexForSettingsExtraction, String mapping) throws IOException {
+
+        String settings = baseIndexSettings;
+
+        // Extract existing settings on index that still exists
+        if (originalIndexForSettingsExtraction != null) {
+            JSONObject originalIndexSettings = new JSONObject(HttpUtils.executeGetRequest(httpClient, esAddress + "/" + originalIndexForSettingsExtraction + "/_settings", null));
+            settings = settings
+                    .replace("#numberOfShards", originalIndexSettings.getJSONObject(originalIndexForSettingsExtraction).getJSONObject("settings").getJSONObject("index").getString("number_of_shards"))
+                    .replace("#numberOfReplicas", originalIndexSettings.getJSONObject(originalIndexForSettingsExtraction).getJSONObject("settings").getJSONObject("index").getString("number_of_replicas"))
+                    .replace("#maxDocValueFieldsSearch", originalIndexSettings.getJSONObject(originalIndexForSettingsExtraction).getJSONObject("settings").getJSONObject("index").getString("max_docvalue_fields_search"))
+                    .replace("#mappingTotalFieldsLimit", originalIndexSettings.getJSONObject(originalIndexForSettingsExtraction).getJSONObject("settings").getJSONObject("index").getJSONObject("mapping").getJSONObject("total_fields").getString("limit"));
+        }
+
+        return settings.replace("#mappings", mapping);
+    }
+
     public static void reIndex(CloseableHttpClient httpClient, BundleContext bundleContext, String esAddress, String indexName,
             String newIndexSettings, String painlessScript) throws IOException {
         String indexNameCloned = indexName + "-cloned";
 
-        // Init requests
-        JSONObject originalIndexSettings = new JSONObject(HttpUtils.executeGetRequest(httpClient, esAddress + "/" + indexName + "/_settings", null));
-        String newIndexRequest = newIndexSettings
-                .replace("#numberOfShards", originalIndexSettings.getJSONObject(indexName).getJSONObject("settings").getJSONObject("index").getString("number_of_shards"))
-                .replace("#numberOfReplicas", originalIndexSettings.getJSONObject(indexName).getJSONObject("settings").getJSONObject("index").getString("number_of_replicas"))
-                .replace("#maxDocValueFieldsSearch", originalIndexSettings.getJSONObject(indexName).getJSONObject("settings").getJSONObject("index").getString("max_docvalue_fields_search"))
-                .replace("#mappingTotalFieldsLimit", originalIndexSettings.getJSONObject(indexName).getJSONObject("settings").getJSONObject("index").getJSONObject("mapping").getJSONObject("total_fields").getString("limit"));
         String reIndexRequest = resourceAsString(bundleContext, "requestBody/2.0.0/base_reindex_request.json")
                 .replace("#source", indexNameCloned).replace("#dest", indexName)
                 .replace("#painless", StringUtils.isNotEmpty(painlessScript) ? getScriptPart(painlessScript) : "");
@@ -121,7 +149,7 @@ public class MigrationUtils {
         // Delete original index
         HttpUtils.executeDeleteRequest(httpClient, esAddress + "/" + indexName, null);
         // Recreate the original index with new mappings
-        HttpUtils.executePutRequest(httpClient, esAddress + "/" + indexName, newIndexRequest, null);
+        HttpUtils.executePutRequest(httpClient, esAddress + "/" + indexName, newIndexSettings, null);
         // Reindex data from clone
         HttpUtils.executePostRequest(httpClient, esAddress + "/_reindex", reIndexRequest, null);
         // Remove clone
diff --git a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-01-segmentReindex.groovy b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-01-segmentReindex.groovy
index e653abbbc..0cfdbc8e8 100644
--- a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-01-segmentReindex.groovy
+++ b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-01-segmentReindex.groovy
@@ -20,5 +20,7 @@ import org.apache.unomi.shell.migration.utils.MigrationUtils
 String esAddress = migrationConfig.getString("esAddress", session)
 String indexPrefix = migrationConfig.getString("indexPrefix", session)
 
-String newIndexSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/segment_index.json")
+String baseSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/base_index_mapping.json")
+String mapping = MigrationUtils.extractMappingFromBundles(bundleContext, "segment.json")
+String newIndexSettings = MigrationUtils.buildIndexCreationRequest(httpClient, esAddress, baseSettings, indexPrefix + "-segment", mapping)
 MigrationUtils.reIndex(httpClient, bundleContext, esAddress, indexPrefix + "-segment", newIndexSettings, null)
diff --git a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-02-scoringPlanReindex.groovy b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-02-scoringPlanReindex.groovy
index df41aa62d..b475fde56 100644
--- a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-02-scoringPlanReindex.groovy
+++ b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-02-scoringPlanReindex.groovy
@@ -20,5 +20,7 @@ import org.apache.unomi.shell.migration.utils.MigrationUtils
 String esAddress = migrationConfig.getString("esAddress", session)
 String indexPrefix = migrationConfig.getString("indexPrefix", session)
 
-String newIndexSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/scoring_index.json")
+String baseSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/base_index_mapping.json")
+String mapping = MigrationUtils.extractMappingFromBundles(bundleContext, "scoring.json")
+String newIndexSettings = MigrationUtils.buildIndexCreationRequest(httpClient, esAddress, baseSettings, indexPrefix + "-scoring", mapping)
 MigrationUtils.reIndex(httpClient, bundleContext, esAddress, indexPrefix + "-scoring", newIndexSettings, null)
diff --git a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-03-profileReindex.groovy b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-03-profileReindex.groovy
index f82794ec2..1fae7ffdb 100644
--- a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-03-profileReindex.groovy
+++ b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-03-profileReindex.groovy
@@ -20,6 +20,8 @@ import org.apache.unomi.shell.migration.utils.MigrationUtils
 String esAddress = migrationConfig.getString("esAddress", session)
 String indexPrefix = migrationConfig.getString("indexPrefix", session)
 
-String newIndexSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/profile_index.json")
+String baseSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/base_index_mapping.json")
+String mapping = MigrationUtils.extractMappingFromBundles(bundleContext, "profile.json")
+String newIndexSettings = MigrationUtils.buildIndexCreationRequest(httpClient, esAddress, baseSettings, indexPrefix + "-profile", mapping)
 MigrationUtils.reIndex(httpClient, bundleContext, esAddress, indexPrefix + "-profile",
         newIndexSettings, MigrationUtils.getFileWithoutComments(bundleContext, "requestBody/2.0.0/profile_migrate.painless"))
diff --git a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-04-eventsReindex.groovy b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-04-eventsReindex.groovy
index 4f2751db7..aaad0599b 100644
--- a/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-04-eventsReindex.groovy
+++ b/tools/shell-commands/src/main/resources/META-INF/cxs/migration/migrate-2.0.0-04-eventsReindex.groovy
@@ -26,9 +26,11 @@ String removeInternalEventsRequest = MigrationUtils.resourceAsString(bundleConte
 HttpUtils.executePostRequest(httpClient, "${esAddress}/${indexPrefix}-event-*/_delete_by_query", removeInternalEventsRequest, null)
 
 // Reindex the rest of the events
-String newIndexSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/event_index.json");
+String baseSettings = MigrationUtils.resourceAsString(bundleContext, "requestBody/2.0.0/base_index_mapping.json")
 String reIndexScript = MigrationUtils.getFileWithoutComments(bundleContext, "requestBody/2.0.0/event_migrate.painless");
+String mapping = MigrationUtils.extractMappingFromBundles(bundleContext, "event.json")
 Set<String> eventIndices = MigrationUtils.getIndexesPrefixedBy(httpClient, esAddress, "${indexPrefix}-event-")
 eventIndices.each { eventIndex ->
+    String newIndexSettings = MigrationUtils.buildIndexCreationRequest(httpClient, esAddress, baseSettings, eventIndex, mapping)
     MigrationUtils.reIndex(httpClient, bundleContext, esAddress, eventIndex, newIndexSettings, reIndexScript)
 }
\ No newline at end of file
diff --git a/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg b/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg
index 8c1a5dc0f..960020cee 100644
--- a/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg
+++ b/tools/shell-commands/src/main/resources/org.apache.unomi.migration.cfg
@@ -19,8 +19,4 @@
 
 # esAddress = http://localhost:9200
 # httpClient.trustAllCertificates = true
-# indexPrefix = context
-# number_of_shards = 3
-# number_of_replicas = 0
-# mapping.total_fields.limit = 1000
-# max_docvalue_fields_search = 1000
+# indexPrefix = context
\ No newline at end of file
diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/base_index_mapping.json b/tools/shell-commands/src/main/resources/requestBody/2.0.0/base_index_mapping.json
new file mode 100644
index 000000000..a5de5759a
--- /dev/null
+++ b/tools/shell-commands/src/main/resources/requestBody/2.0.0/base_index_mapping.json
@@ -0,0 +1,23 @@
+{
+  "settings": {
+    "index": {
+      "number_of_shards": #numberOfShards,
+      "number_of_replicas": #numberOfReplicas,
+      "mapping.total_fields.limit": #mappingTotalFieldsLimit,
+      "max_docvalue_fields_search": #maxDocValueFieldsSearch
+    },
+    "analysis": {
+      "analyzer": {
+        "folding": {
+          "type": "custom",
+          "tokenizer": "keyword",
+          "filter": [
+            "lowercase",
+            "asciifolding"
+          ]
+        }
+      }
+    }
+  },
+  "mappings": #mappings
+}
\ No newline at end of file
diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_index.json b/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_index.json
deleted file mode 100644
index a0e25f945..000000000
--- a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_index.json
+++ /dev/null
@@ -1,87 +0,0 @@
-{
-  "settings": {
-    "index": {
-      "number_of_shards": #numberOfShards,
-      "number_of_replicas": #numberOfReplicas,
-      "mapping.total_fields.limit": #mappingTotalFieldsLimit,
-      "max_docvalue_fields_search": #maxDocValueFieldsSearch
-    },
-    "analysis": {
-      "analyzer": {
-        "folding": {
-          "type": "custom",
-          "tokenizer": "keyword",
-          "filter": [
-            "lowercase",
-            "asciifolding"
-          ]
-        }
-      }
-    }
-  },
-  "mappings": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "string",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding",
-            "fields": {
-              "keyword": {
-                "type": "keyword",
-                "ignore_above": 256
-              }
-            }
-          }
-        }
-      }
-    ],
-    "properties": {
-      "flattenedProperties": {
-        "type": "flattened"
-      },
-      "timeStamp": {
-        "type": "date"
-      },
-      "target" : {
-        "properties" : {
-          "lastEventDate" : {
-            "type" : "date"
-          },
-          "profile" : {
-            "properties" : {
-              "properties" : {
-                "properties" : {
-                  "birthDate" : {
-                    "type" : "date"
-                  },
-                  "firstVisit" : {
-                    "type" : "date"
-                  },
-                  "lastVisit" : {
-                    "type" : "date"
-                  },
-                  "notificationRefreshDate" : {
-                    "type" : "date"
-                  },
-                  "previousVisit" : {
-                    "type" : "date"
-                  }
-                }
-              },
-              "systemProperties" : {
-                "properties" : {
-
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-
-}
diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/profile_index.json b/tools/shell-commands/src/main/resources/requestBody/2.0.0/profile_index.json
deleted file mode 100644
index 0808aa03e..000000000
--- a/tools/shell-commands/src/main/resources/requestBody/2.0.0/profile_index.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-    "settings": {
-        "index": {
-            "number_of_shards": #numberOfShards,
-            "number_of_replicas": #numberOfReplicas,
-            "mapping.total_fields.limit": #mappingTotalFieldsLimit,
-            "max_docvalue_fields_search": #maxDocValueFieldsSearch
-        },
-        "analysis": {
-            "analyzer": {
-                "folding": {
-                    "type": "custom",
-                    "tokenizer": "keyword",
-                    "filter": [
-                        "lowercase",
-                        "asciifolding"
-                    ]
-                }
-            }
-        }
-    },
-    "mappings": {
-        "dynamic_templates": [
-            {
-                "all": {
-                    "match": "*",
-                    "match_mapping_type": "string",
-                    "mapping": {
-                        "type": "text",
-                        "analyzer": "folding",
-                        "fields": {
-                            "keyword": {
-                                "type": "keyword",
-                                "ignore_above": 256
-                            }
-                        }
-                    }
-                }
-            }
-        ],
-        "properties": {
-            "properties": {
-                "properties": {
-                    "age": {
-                        "type": "long"
-                    },
-                    "firstVisit": {
-                        "type": "date"
-                    },
-                    "lastVisit": {
-                        "type": "date"
-                    },
-                    "previousVisit": {
-                        "type": "date"
-                    },
-                    "nbOfVisits": {
-                        "type": "long"
-                    },
-                    "interests": {
-                        "type": "nested"
-                    }
-                }
-            },
-            "consents": {
-                "properties": {
-                    "statusDate": {
-                        "type": "date"
-                    },
-                    "revokeDate": {
-                        "type": "date"
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/scoring_index.json b/tools/shell-commands/src/main/resources/requestBody/2.0.0/scoring_index.json
deleted file mode 100644
index d2541861d..000000000
--- a/tools/shell-commands/src/main/resources/requestBody/2.0.0/scoring_index.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
-  "settings": {
-    "index": {
-      "number_of_shards": #numberOfShards,
-      "number_of_replicas": #numberOfReplicas,
-      "mapping.total_fields.limit": #mappingTotalFieldsLimit,
-      "max_docvalue_fields_search": #maxDocValueFieldsSearch
-    },
-    "analysis": {
-      "analyzer": {
-        "folding": {
-          "type": "custom",
-          "tokenizer": "keyword",
-          "filter": [
-            "lowercase",
-            "asciifolding"
-          ]
-        }
-      }
-    }
-  },
-  "mappings": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "string",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding",
-            "fields": {
-              "keyword": {
-                "type": "keyword",
-                "ignore_above": 256
-              }
-            }
-          }
-        }
-      }
-    ],
-    "properties": {
-      "metadata": {
-        "properties": {
-          "enabled": {
-            "type": "boolean"
-          },
-          "hidden": {
-            "type": "boolean"
-          },
-          "missingPlugins": {
-            "type": "boolean"
-          },
-          "readOnly": {
-            "type": "boolean"
-          }
-        }
-      },
-      "elements": {
-        "properties": {
-          "condition": {
-            "type": "object",
-            "enabled": false
-          }
-        }
-      }
-    }
-  }
-}
diff --git a/tools/shell-commands/src/main/resources/requestBody/2.0.0/segment_index.json b/tools/shell-commands/src/main/resources/requestBody/2.0.0/segment_index.json
deleted file mode 100644
index ec8a3c336..000000000
--- a/tools/shell-commands/src/main/resources/requestBody/2.0.0/segment_index.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
-  "settings": {
-    "index": {
-      "number_of_shards": #numberOfShards,
-      "number_of_replicas": #numberOfReplicas,
-      "mapping.total_fields.limit": #mappingTotalFieldsLimit,
-      "max_docvalue_fields_search": #maxDocValueFieldsSearch
-    },
-    "analysis": {
-      "analyzer": {
-        "folding": {
-          "type": "custom",
-          "tokenizer": "keyword",
-          "filter": [
-            "lowercase",
-            "asciifolding"
-          ]
-        }
-      }
-    }
-  },
-  "mappings": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "string",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding",
-            "fields": {
-              "keyword": {
-                "type": "keyword",
-                "ignore_above": 256
-              }
-            }
-          }
-        }
-      }
-    ],
-    "properties": {
-      "metadata": {
-        "properties": {
-          "enabled": {
-            "type": "boolean"
-          },
-          "hidden": {
-            "type": "boolean"
-          },
-          "missingPlugins": {
-            "type": "boolean"
-          },
-          "readOnly": {
-            "type": "boolean"
-          }
-        }
-      },
-      "condition": {
-        "type": "object",
-        "enabled": false
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/tools/shell-commands/src/main/resources/requestBody/scopeMapping.json b/tools/shell-commands/src/main/resources/requestBody/scopeMapping.json
deleted file mode 100644
index b45b0a851..000000000
--- a/tools/shell-commands/src/main/resources/requestBody/scopeMapping.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
-  "settings": {
-    "index": {
-      "number_of_shards": $numberOfShards,
-      "number_of_replicas": $numberOfReplicas,
-      "mapping.total_fields.limit": $mappingTotalFieldsLimit,
-      "max_docvalue_fields_search": $maxDocValueFieldsSearch
-    },
-    "analysis": {
-      "analyzer": {
-        "folding": {
-          "type": "custom",
-          "tokenizer": "keyword",
-          "filter": [
-            "lowercase",
-            "asciifolding"
-          ]
-        }
-      }
-    }
-  },
-  "mappings": {
-    "dynamic_templates": [
-      {
-        "all": {
-          "match": "*",
-          "match_mapping_type": "string",
-          "mapping": {
-            "type": "text",
-            "analyzer": "folding",
-            "fields": {
-              "keyword": {
-                "type": "keyword",
-                "ignore_above": 256
-              }
-            }
-          }
-        }
-      }
-    ],
-    "properties": {
-    }
-  }
-}