Class MigrationUtils


  • public class MigrationUtils
    extends Object
    Author:
    dgaillard
    • Constructor Detail

      • MigrationUtils

        public MigrationUtils()
    • Method Detail

      • queryWithScroll

        public static org.json.JSONObject queryWithScroll​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                                          String url)
                                                   throws IOException
        Throws:
        IOException
      • continueQueryWithScroll

        public static org.json.JSONObject continueQueryWithScroll​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                                                  String url,
                                                                  String scrollId)
                                                           throws IOException
        Throws:
        IOException
      • bulkUpdate

        public static void bulkUpdate​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                      String url,
                                      String jsonData)
                               throws IOException
        Throws:
        IOException
      • resourceAsString

        public static String resourceAsString​(org.osgi.framework.BundleContext bundleContext,
                                              String resource)
      • getFileWithoutComments

        public static String getFileWithoutComments​(org.osgi.framework.BundleContext bundleContext,
                                                    String resource)
      • indexExists

        public static boolean indexExists​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                          String esAddress,
                                          String indexName)
                                   throws IOException
        Throws:
        IOException
      • cleanAllIndexWithRollover

        public static void cleanAllIndexWithRollover​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                                     org.osgi.framework.BundleContext bundleContext,
                                                     String esAddress,
                                                     String prefix,
                                                     String indexName)
                                              throws IOException
        Throws:
        IOException
      • extractMappingFromBundles

        public static String extractMappingFromBundles​(org.osgi.framework.BundleContext bundleContext,
                                                       String fileName)
                                                throws IOException
        Throws:
        IOException
      • moveToIndex

        public static void moveToIndex​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                       org.osgi.framework.BundleContext bundleContext,
                                       String esAddress,
                                       String sourceIndexName,
                                       String targetIndexName,
                                       String painlessScript)
                                throws Exception
        Throws:
        Exception
      • deleteIndex

        public static void deleteIndex​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                       String esAddress,
                                       String indexName)
                                throws Exception
        Throws:
        Exception
      • reIndex

        public static void reIndex​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                   org.osgi.framework.BundleContext bundleContext,
                                   String esAddress,
                                   String indexName,
                                   String newIndexSettings,
                                   String painlessScript,
                                   MigrationContext migrationContext)
                            throws Exception
        Throws:
        Exception
      • waitForYellowStatus

        public static void waitForYellowStatus​(org.apache.http.impl.client.CloseableHttpClient httpClient,
                                               String esAddress,
                                               MigrationContext migrationContext)
                                        throws Exception
        Utility method that waits for the ES cluster to be in yellow status
        Throws:
        Exception