Explorar el Código

fix #1612 add index.auto_expand_replicas

Shinsuke Sugaya hace 7 años
padre
commit
a0bbf9e0c3
Se han modificado 42 ficheros con 125 adiciones y 40 borrados
  1. 2 0
      src/main/java/org/codelibs/fess/es/client/FessEsClient.java
  2. 42 0
      src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java
  3. 2 0
      src/main/resources/fess_config.properties
  4. 2 1
      src/main/resources/fess_indices/.fess_config.access_token.json
  5. 2 1
      src/main/resources/fess_indices/.fess_config.bad_word.json
  6. 2 1
      src/main/resources/fess_indices/.fess_config.boost_document_rule.json
  7. 2 1
      src/main/resources/fess_indices/.fess_config.crawling_info.json
  8. 2 1
      src/main/resources/fess_indices/.fess_config.crawling_info_param.json
  9. 2 1
      src/main/resources/fess_indices/.fess_config.data_config.json
  10. 2 1
      src/main/resources/fess_indices/.fess_config.data_config_to_label.json
  11. 2 1
      src/main/resources/fess_indices/.fess_config.data_config_to_role.json
  12. 2 1
      src/main/resources/fess_indices/.fess_config.duplicate_host.json
  13. 2 1
      src/main/resources/fess_indices/.fess_config.elevate_word.json
  14. 2 1
      src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json
  15. 2 1
      src/main/resources/fess_indices/.fess_config.failure_url.json
  16. 2 1
      src/main/resources/fess_indices/.fess_config.file_authentication.json
  17. 2 1
      src/main/resources/fess_indices/.fess_config.file_config.json
  18. 2 1
      src/main/resources/fess_indices/.fess_config.file_config_to_label.json
  19. 2 1
      src/main/resources/fess_indices/.fess_config.file_config_to_role.json
  20. 2 1
      src/main/resources/fess_indices/.fess_config.job_log.json
  21. 2 1
      src/main/resources/fess_indices/.fess_config.key_match.json
  22. 2 1
      src/main/resources/fess_indices/.fess_config.label_to_role.json
  23. 2 1
      src/main/resources/fess_indices/.fess_config.label_type.json
  24. 2 1
      src/main/resources/fess_indices/.fess_config.path_mapping.json
  25. 2 1
      src/main/resources/fess_indices/.fess_config.related_content.json
  26. 2 1
      src/main/resources/fess_indices/.fess_config.related_query.json
  27. 2 1
      src/main/resources/fess_indices/.fess_config.request_header.json
  28. 2 1
      src/main/resources/fess_indices/.fess_config.role_type.json
  29. 2 1
      src/main/resources/fess_indices/.fess_config.scheduled_job.json
  30. 2 1
      src/main/resources/fess_indices/.fess_config.thumbnail_queue.json
  31. 2 1
      src/main/resources/fess_indices/.fess_config.web_authentication.json
  32. 2 1
      src/main/resources/fess_indices/.fess_config.web_config.json
  33. 2 1
      src/main/resources/fess_indices/.fess_config.web_config_to_label.json
  34. 2 1
      src/main/resources/fess_indices/.fess_config.web_config_to_role.json
  35. 2 1
      src/main/resources/fess_indices/.fess_user.group.json
  36. 2 1
      src/main/resources/fess_indices/.fess_user.role.json
  37. 2 1
      src/main/resources/fess_indices/.fess_user.user.json
  38. 3 2
      src/main/resources/fess_indices/fess.json
  39. 2 1
      src/main/resources/fess_indices/fess_log.click_log.json
  40. 2 1
      src/main/resources/fess_indices/fess_log.favorite_log.json
  41. 2 1
      src/main/resources/fess_indices/fess_log.search_log.json
  42. 2 1
      src/main/resources/fess_indices/fess_log.user_info.json

+ 2 - 0
src/main/java/org/codelibs/fess/es/client/FessEsClient.java

@@ -404,6 +404,8 @@ public class FessEsClient implements Client {
             }
             source = source.replaceAll(Pattern.quote("${fess.dictionary.path}"), dictionaryPath);
             source = source.replaceAll(Pattern.quote("${fess.index.codec}"), fessConfig.getIndexCodec());
+            source = source.replaceAll(Pattern.quote("${fess.index.number_of_shards}"), fessConfig.getIndexNumberOfShards());
+            source = source.replaceAll(Pattern.quote("${fess.index.auto_expand_replicas}"), fessConfig.getIndexAutoExpandReplicas());
             final CreateIndexResponse indexResponse =
                     client.admin().indices().prepareCreate(indexName).setSource(source, XContentType.JSON).execute()
                             .actionGet(fessConfig.getIndexIndicesTimeout());

+ 42 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -362,6 +362,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. default */
     String INDEX_CODEC = "index.codec";
 
+    /** The key of the configuration. e.g. 5 */
+    String INDEX_number_of_shards = "index.number_of_shards";
+
+    /** The key of the configuration. e.g. 0-1 */
+    String INDEX_auto_expand_replicas = "index.auto_expand_replicas";
+
     /** The key of the configuration. e.g. favorite_count */
     String INDEX_FIELD_favorite_count = "index.field.favorite_count";
 
@@ -2444,6 +2450,28 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     String getIndexCodec();
 
+    /**
+     * Get the value for the key 'index.number_of_shards'. <br>
+     * The value is, e.g. 5 <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getIndexNumberOfShards();
+
+    /**
+     * Get the value for the key 'index.number_of_shards' as {@link Integer}. <br>
+     * The value is, e.g. 5 <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     * @throws NumberFormatException When the property is not integer.
+     */
+    Integer getIndexNumberOfShardsAsInteger();
+
+    /**
+     * Get the value for the key 'index.auto_expand_replicas'. <br>
+     * The value is, e.g. 0-1 <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getIndexAutoExpandReplicas();
+
     /**
      * Get the value for the key 'index.field.favorite_count'. <br>
      * The value is, e.g. favorite_count <br>
@@ -6249,6 +6277,18 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return get(FessConfig.INDEX_CODEC);
         }
 
+        public String getIndexNumberOfShards() {
+            return get(FessConfig.INDEX_number_of_shards);
+        }
+
+        public Integer getIndexNumberOfShardsAsInteger() {
+            return getAsInteger(FessConfig.INDEX_number_of_shards);
+        }
+
+        public String getIndexAutoExpandReplicas() {
+            return get(FessConfig.INDEX_auto_expand_replicas);
+        }
+
         public String getIndexFieldFavoriteCount() {
             return get(FessConfig.INDEX_FIELD_favorite_count);
         }
@@ -8100,6 +8140,8 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             defaultMap.put(FessConfig.INDEXER_DATA_MAX_DOCUMENT_CACHE_SIZE, "5");
             defaultMap.put(FessConfig.INDEXER_DATA_MAX_DOCUMENT_REQUEST_SIZE, "10485760");
             defaultMap.put(FessConfig.INDEX_CODEC, "default");
+            defaultMap.put(FessConfig.INDEX_number_of_shards, "5");
+            defaultMap.put(FessConfig.INDEX_auto_expand_replicas, "0-1");
             defaultMap.put(FessConfig.INDEX_FIELD_favorite_count, "favorite_count");
             defaultMap.put(FessConfig.INDEX_FIELD_click_count, "click_count");
             defaultMap.put(FessConfig.INDEX_FIELD_config_id, "config_id");

+ 2 - 0
src/main/resources/fess_config.properties

@@ -207,6 +207,8 @@ indexer.data.max.document.request.size=10485760
 
 # index setting
 index.codec=default
+index.number_of_shards=5
+index.auto_expand_replicas=0-1
 
 # field names
 index.field.favorite_count=favorite_count

+ 2 - 1
src/main/resources/fess_indices/.fess_config.access_token.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.bad_word.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.boost_document_rule.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.crawling_info.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.crawling_info_param.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.data_config.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.data_config_to_label.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.data_config_to_role.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.duplicate_host.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.elevate_word.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.failure_url.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.file_authentication.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.file_config.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.file_config_to_label.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.file_config_to_role.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.job_log.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.key_match.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.label_to_role.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.label_type.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.path_mapping.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.related_content.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.related_query.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.request_header.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.role_type.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.scheduled_job.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.thumbnail_queue.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.web_authentication.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.web_config.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.web_config_to_label.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_config.web_config_to_role.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 2,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_user.group.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 5,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_user.role.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 5,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/.fess_user.user.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 5,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 3 - 2
src/main/resources/fess_indices/fess.json

@@ -3,8 +3,9 @@
     "index": {
       "codec": "${fess.index.codec}",
       "refresh_interval": "1s",
-      "number_of_shards": 5,
-      "number_of_replicas": 0
+      "number_of_shards": "${fess.index.number_of_shards}",
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "${fess.index.auto_expand_replicas}"
     },
     "analysis": {
       "char_filter": {

+ 2 - 1
src/main/resources/fess_indices/fess_log.click_log.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 10,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/fess_log.favorite_log.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 10,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/fess_log.search_log.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 10,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }

+ 2 - 1
src/main/resources/fess_indices/fess_log.user_info.json

@@ -3,7 +3,8 @@
     "index": {
       "refresh_interval": "1s",
       "number_of_shards": 10,
-      "number_of_replicas": 0
+      "number_of_replicas": 0,
+      "auto_expand_replicas": "0-1"
     }
   }
 }