فهرست منبع

HUE-6954 [indexer] Support different number of shards, replication at index creation

Romain Rigaux 8 سال پیش
والد
کامیت
d4f453f

+ 3 - 1
desktop/libs/indexer/src/indexer/api3.py

@@ -209,7 +209,9 @@ def _create_index(user, fs, client, source, destination, index_name):
         name=index_name,
         fields=fields,
         unique_key_field=unique_key_field,
-        df=df
+        df=df,
+        shards=destination['indexerNumShards'],
+        replication=destination['indexerReplicationFactor']
     )
 
   if source['inputFormat'] != 'manual':

+ 2 - 2
desktop/libs/indexer/src/indexer/solr_client.py

@@ -89,12 +89,12 @@ class SolrClient(object):
 
     return indexes
 
-  def create_index(self, name, fields, config_name=None, unique_key_field=None, df=None):
+  def create_index(self, name, fields, config_name=None, unique_key_field=None, df=None, shards=1, replication=1):
     if self.is_solr_cloud_mode():
       if config_name is None:
         self._create_cloud_config(name, fields, unique_key_field, df)
 
-      self.api.create_collection2(name, config_name=config_name)
+      self.api.create_collection2(name, config_name=config_name, shards=shards, replication=replication)
       fields = [{
           'name': field['name'],
           'type': field['type'],

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -1389,7 +1389,7 @@ ${ assist.assistPanel() }
       self.indexerJobLibPath = ko.observable('${ CONFIG_INDEXER_LIBS_PATH.get() }');
       self.indexerConfigSet = ko.observable('');
       self.indexerConfigSets = ko.observableArray([]);
-      self.indexerNumShards = ko.observable('');
+      self.indexerNumShards = ko.observable(1);
       self.indexerReplicationFactor = ko.observable(1);
       self.indexerPrimaryKey = ko.observableArray();
       self.indexerPrimaryKeyObject = ko.observableArray();