about summary refs log tree commit diff
path: root/nixos/modules/services/search
diff options
context:
space:
mode:
authorhappysalada <raphael@megzari.com>2021-09-17 01:18:09 +0900
committerRaphael Megzari <raphael@megzari.com>2021-09-20 14:31:02 +0900
commitb51e813153d87636526c6ab2ca02dc3466f05a26 (patch)
treecc962d6104b1abc76158d45286bccc059256ff12 /nixos/modules/services/search
parent2b65a74aba274a06a673dfb6f28b96cbe0b032fb (diff)
elasticsearch: support version 6
Diffstat (limited to 'nixos/modules/services/search')
-rw-r--r--nixos/modules/services/search/elasticsearch.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix
index 3f676db275238..40ebe29c9a600 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -5,13 +5,13 @@ with lib;
 let
   cfg = config.services.elasticsearch;
 
+  es7 = builtins.compareVersions cfg.package.version "7" >= 0;
+
   esConfig = ''
     network.host: ${cfg.listenAddress}
     cluster.name: ${cfg.cluster_name}
-    ${lib.optionalString cfg.single_node ''
-      discovery.type: single-node
-      gateway.auto_import_dangling_indices: true
-    ''}
+    ${lib.optionalString cfg.single_node "discovery.type: single-node"}
+    ${lib.optionalString (cfg.single_node && es7) "gateway.auto_import_dangling_indices: true"}
 
     http.port: ${toString cfg.port}
     transport.port: ${toString cfg.tcp_port}