aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-search/pom.xml4
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/EsSettings.java57
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchServer.java171
-rw-r--r--server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java30
-rw-r--r--server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java83
-rw-r--r--server/sonar-server/pom.xml19
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/EsClientProvider.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java3
-rw-r--r--sonar-application/assembly.xml2
-rw-r--r--sonar-application/pom.xml4
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/LICENSE.txt202
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/NOTICE.txt5
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/README.textile238
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/VERSION.txt2
-rwxr-xr-xsonar-application/src/main/assembly/elasticsearch/bin/elasticsearch200
-rwxr-xr-xsonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin91
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin.bat30
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-mgr.exebin0 -> 104448 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x64.exebin0 -> 103936 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x86.exebin0 -> 80896 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service.bat349
-rwxr-xr-xsonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-systemd-pre-exec7
-rwxr-xr-xsonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog90
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog.bat61
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.bat84
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.bat25
-rwxr-xr-xsonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.sh13
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/config/elasticsearch.yml91
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/config/jvm.options103
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/config/log4j2.properties74
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/HdrHistogram-2.1.6.jarbin0 -> 109723 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/elasticsearch-5.0.2.jarbin0 -> 9437294 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/hppc-0.7.1.jarbin0 -> 1140290 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jackson-core-2.8.1.jarbin0 -> 280014 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-cbor-2.8.1.jarbin0 -> 50196 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-smile-2.8.1.jarbin0 -> 72874 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-yaml-2.8.1.jarbin0 -> 40540 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jna-4.2.2.jarbin0 -> 1137286 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/joda-time-2.9.5.jarbin0 -> 632037 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jopt-simple-5.0.2.jarbin0 -> 78074 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/jts-1.13.jarbin0 -> 794991 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/log4j-1.2-api-2.6.2.jarbin0 -> 43109 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/log4j-api-2.6.2.jarbin0 -> 198736 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/log4j-core-2.6.2.jarbin0 -> 1191946 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-analyzers-common-6.2.1.jarbin0 -> 1472270 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-backward-codecs-6.2.1.jarbin0 -> 87409 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-core-6.2.1.jarbin0 -> 2581808 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-grouping-6.2.1.jarbin0 -> 106588 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-highlighter-6.2.1.jarbin0 -> 144208 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-join-6.2.1.jarbin0 -> 150045 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-memory-6.2.1.jarbin0 -> 46139 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-misc-6.2.1.jarbin0 -> 142514 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-queries-6.2.1.jarbin0 -> 225188 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-queryparser-6.2.1.jarbin0 -> 404072 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-sandbox-6.2.1.jarbin0 -> 187507 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-6.2.1.jarbin0 -> 56583 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-extras-6.2.1.jarbin0 -> 196508 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial3d-6.2.1.jarbin0 -> 236260 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/lucene-suggest-6.2.1.jarbin0 -> 246927 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/securesm-1.1.jarbin0 -> 7419 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/snakeyaml-1.15.jarbin0 -> 269295 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/spatial4j-0.6.jarbin0 -> 187537 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/lib/t-digest-3.0.jarbin0 -> 49754 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.0.2.jarbin0 -> 49820 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/ingest-common-5.0.2.jarbin0 -> 93451 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/jcodings-1.0.12.jarbin0 -> 1512807 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/joni-2.1.6.jarbin0 -> 189961 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jarbin0 -> 302034 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-5.0.4.jarbin0 -> 53297 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-commons-5.0.4.jarbin0 -> 41796 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-tree-5.0.4.jarbin0 -> 29050 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lang-expression-5.0.2.jarbin0 -> 45819 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lucene-expressions-6.2.1.jarbin0 -> 76996 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-security.policy32
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jarbin0 -> 4527730 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/lang-groovy-5.0.2.jarbin0 -> 18106 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-security.policy59
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/compiler-0.9.3.jarbin0 -> 99939 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/lang-mustache-5.0.2.jarbin0 -> 61105 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-security.policy23
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jarbin0 -> 302034 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/asm-debug-all-5.1.jarbin0 -> 387750 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/lang-painless-5.0.2.jarbin0 -> 431876 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-security.policy23
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/percolator/percolator-5.0.2.jarbin0 -> 101033 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/percolator/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-codec-1.10.jarbin0 -> 284184 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-logging-1.1.3.jarbin0 -> 62050 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpasyncclient-4.1.2.jarbin0 -> 177112 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpclient-4.5.2.jarbin0 -> 736658 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-4.4.5.jarbin0 -> 327373 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-nio-4.4.5.jarbin0 -> 356201 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/reindex-5.0.2.jarbin0 -> 152888 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/reindex/rest-5.0.2.jarbin0 -> 33211 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jarbin0 -> 1292696 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-security.policy24
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/transport-netty3-5.0.2.jarbin0 -> 76741 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-buffer-4.1.5.Final.jarbin0 -> 253204 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-4.1.5.Final.jarbin0 -> 304525 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-http-4.1.5.Final.jarbin0 -> 537089 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-common-4.1.5.Final.jarbin0 -> 685659 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-handler-4.1.5.Final.jarbin0 -> 315388 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-resolver-4.1.5.Final.jarbin0 -> 25656 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-transport-4.1.5.Final.jarbin0 -> 424455 bytes
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-descriptor.properties40
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-security.policy24
-rw-r--r--sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/transport-netty4-5.0.2.jarbin0 -> 75018 bytes
115 files changed, 2474 insertions, 155 deletions
diff --git a/server/sonar-search/pom.xml b/server/sonar-search/pom.xml
index 4f56354b14c..7d4b3282a28 100644
--- a/server/sonar-search/pom.xml
+++ b/server/sonar-search/pom.xml
@@ -20,10 +20,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.elasticsearch</groupId>
- <artifactId>elasticsearch</artifactId>
- </dependency>
- <dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency>
diff --git a/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java b/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
index 94532b2761d..ce8c668f528 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/EsSettings.java
@@ -23,6 +23,8 @@ import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
@@ -74,17 +76,17 @@ public class EsSettings implements EsSettingsMBean {
return nodeName;
}
- Settings build() {
- Settings.Builder builder = Settings.builder();
+ Map<String, String> build() {
+ Map<String, String> builder = new HashMap<>();
configureFileSystem(builder);
configureIndexDefaults(builder);
configureNetwork(builder);
configureCluster(builder);
configureMarvel(builder);
- return builder.build();
+ return builder;
}
- private void configureFileSystem(Settings.Builder builder) {
+ private void configureFileSystem(Map<String, String> builder) {
File homeDir = props.nonNullValueAsFile(ProcessProperties.PATH_HOME);
File dataDir;
File logDir;
@@ -99,7 +101,7 @@ public class EsSettings implements EsSettingsMBean {
builder.put("path.data", dataDir.getAbsolutePath());
String tempPath = props.value(ProcessProperties.PATH_TEMP);
- builder.put("path.home", new File(tempPath, "es"));
+ builder.put("path.home", new File(tempPath, "es").getAbsolutePath());
// log dir
String logPath = props.value(ProcessProperties.PATH_LOGS);
@@ -111,31 +113,30 @@ public class EsSettings implements EsSettingsMBean {
builder.put("path.logs", logDir.getAbsolutePath());
}
- private void configureNetwork(Settings.Builder builder) {
+ private void configureNetwork(Map<String, String> builder) {
InetAddress host = readHost();
int port = Integer.parseInt(props.nonNullValue(ProcessProperties.SEARCH_PORT));
LOGGER.info("Elasticsearch listening on {}:{}", host, port);
- builder
- .put("transport.tcp.port", port)
- .put("transport.host", host.getHostAddress())
- .put("network.host", host.getHostAddress());
+ builder.put("transport.tcp.port", String.valueOf(port));
+ builder.put("transport.host", String.valueOf(host.getHostAddress()));
+ builder.put("network.host", String.valueOf(host.getHostAddress()));
// Elasticsearch sets the default value of TCP reuse address to true only on non-MSWindows machines, but why ?
- builder.put("network.tcp.reuse_address", true);
+ builder.put("network.tcp.reuse_address", String.valueOf(true));
int httpPort = getHttpPort();
if (httpPort < 0) {
// standard configuration
- builder.put("http.enabled", false);
+ builder.put("http.enabled", String.valueOf(false));
} else {
LOGGER.warn("Elasticsearch HTTP connector is enabled on port {}. MUST NOT BE USED FOR PRODUCTION", httpPort);
// see https://github.com/lmenezes/elasticsearch-kopf/issues/195
- builder.put("http.cors.enabled", true)
- .put("http.cors.allow-origin", "*")
- .put("http.enabled", true)
- .put("http.host", host.getHostAddress())
- .put("http.port", httpPort);
+ builder.put("http.cors.enabled", String.valueOf(true));
+ builder.put("http.cors.allow-origin", "*");
+ builder.put("http.enabled", String.valueOf(true));
+ builder.put("http.host", host.getHostAddress());
+ builder.put("http.port", String.valueOf(httpPort));
}
}
@@ -157,7 +158,7 @@ public class EsSettings implements EsSettingsMBean {
.put("action.auto_create_index", false);
}
- private void configureCluster(Settings.Builder builder) {
+ private void configureCluster(Map<String, String> builder) {
// Default value in a standalone mode, not overridable
int replicationFactor = 0;
int minimumMasterNodes = 1;
@@ -173,18 +174,18 @@ public class EsSettings implements EsSettingsMBean {
builder.put("discovery.zen.ping.unicast.hosts", hosts);
}
- builder.put("discovery.zen.minimum_master_nodes", minimumMasterNodes)
- .put("discovery.initial_state_timeout", initialStateTimeOut)
- .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, replicationFactor)
- .put("cluster.name", getClusterName())
- .put("cluster.routing.allocation.awareness.attributes", "rack_id")
- .put("node.attr.rack_id", nodeName)
- .put("node.name", nodeName)
- .put("node.data", true)
- .put("node.master", true);
+ builder.put("discovery.zen.minimum_master_nodes", String.valueOf(minimumMasterNodes));
+ builder.put("discovery.initial_state_timeout", initialStateTimeOut);
+ builder.put("index.number_of_replicas", String.valueOf(replicationFactor));
+ builder.put("cluster.name", getClusterName());
+ builder.put("cluster.routing.allocation.awareness.attributes", "rack_id");
+ builder.put("node.attr.rack_id", nodeName);
+ builder.put("node.name", nodeName);
+ builder.put("node.data", String.valueOf(true));
+ builder.put("node.master", String.valueOf(true));
}
- private void configureMarvel(Settings.Builder builder) {
+ private void configureMarvel(Map<String, String> builder) {
Set<String> marvels = new TreeSet<>();
marvels.addAll(Arrays.asList(StringUtils.split(props.value(PROP_MARVEL_HOSTS, ""), ",")));
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
index bdcce3718ab..550675f63a2 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
@@ -19,16 +19,23 @@
*/
package org.sonar.search;
+import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
-import org.apache.lucene.util.StringHelper;
-import org.elasticsearch.cluster.health.ClusterHealthStatus;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.node.Node;
-import org.elasticsearch.node.NodeValidationException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.process.Jmx;
import org.sonar.process.MinimumViableSystem;
import org.sonar.process.Monitored;
import org.sonar.process.ProcessEntryPoint;
@@ -38,10 +45,9 @@ public class SearchServer implements Monitored {
// VisibleForTesting
protected static Logger LOGGER = LoggerFactory.getLogger(SearchServer.class);
- private static final String MIMINUM_MASTER_NODES = "discovery.zen.minimum_master_nodes";
- private static final String INITIAL_STATE_TIMEOUT = "discovery.initial_state_timeout";
private final EsSettings settings;
- private Node node;
+ private Process p;
+ private String url;
public SearchServer(Props props) {
this.settings = new EsSettings(props);
@@ -51,37 +57,114 @@ public class SearchServer implements Monitored {
@Override
public void start() {
- Jmx.register(EsSettingsMBean.OBJECT_NAME, settings);
- initBootstrap();
- Settings esSettings = settings.build();
- if (esSettings.getAsInt(MIMINUM_MASTER_NODES, 1) >= 2) {
- LOGGER.info("Elasticsearch is waiting {} for {} node(s) to be up to start.",
- esSettings.get(INITIAL_STATE_TIMEOUT),
- esSettings.get(MIMINUM_MASTER_NODES));
+ Path path = Paths.get(getExecutable());
+ if (!path.toFile().exists()) {
+ throw new IllegalStateException("Cannot find elasticsearch binary");
}
- node = new Node(settings.build());
+ String absolutePath = path.toAbsolutePath().toString();
+
+ List<String> command = new ArrayList<>();
+ command.add(absolutePath);
+ Map<String, String> settingsMap = settings.build();
+ settingsMap.entrySet().stream()
+ .filter(entry -> !"path.home".equals(entry.getKey()))
+ .forEach(entry -> command.add("-E" + entry.getKey() + "=" + entry.getValue()));
+ url = "http://"+settingsMap.get("http.host") + ":" + settingsMap.get("http.port");
+ System.out.println(command.stream().collect(Collectors.joining(" ")));
+ ProcessBuilder builder = new ProcessBuilder(command)
+ .directory(new File(path.getParent().toAbsolutePath().toString()));
+ builder.redirectOutput(ProcessBuilder.Redirect.PIPE);
+ builder.redirectErrorStream(true);
+ try {
+ p = builder.start();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ CountDownLatch latch = new CountDownLatch(2);
+
+ new Thread(() -> {
+ InputStream inputStream = p.getInputStream();
+ InputStreamReader reader1 = new InputStreamReader(inputStream);
+ BufferedReader reader = new BufferedReader(reader1);
+ String line;
+ try {
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line);
+ if (line.contains(" publish_address ")) {
+ latch.countDown();
+ }
+ if (line.contains(" started")) {
+ latch.countDown();
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }).start();
+
try {
- node.start();
- } catch (NodeValidationException e) {
- throw new RuntimeException("Failed to start ES", e);
+ latch.await();
+ } catch (InterruptedException e) {
+ // no action required
+ }
+
+ String urlString = url+"/_cluster/health?wait_for_status=yellow&timeout=30s";
+ try {
+ URL url = new URL(urlString);
+ url.openConnection();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
}
}
- // copied from https://github.com/elastic/elasticsearch/blob/v2.3.3/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
- private static void initBootstrap() {
- // init lucene random seed. it will use /dev/urandom where available:
- StringHelper.randomId();
+ private static String getExecutable() {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ return "elasticsearch/bin/elasticsearch.bat";
+ }
+ return "elasticsearch/bin/elasticsearch";
}
@Override
public Status getStatus() {
- boolean esStatus = node != null && node.client().admin().cluster().prepareHealth()
- .setWaitForYellowStatus()
- .setTimeout(TimeValue.timeValueSeconds(30L))
- .get()
- .getStatus() != ClusterHealthStatus.RED;
- if (esStatus) {
- return Status.OPERATIONAL;
+ Status status = null;
+ try {
+ status = getStatus2();
+ System.out.println("ES STATUS "+status);
+ return status;
+ } catch (Exception e) {
+ System.out.println("ES STATUS "+e.getMessage());
+ throw new RuntimeException(e);
+ }
+ }
+
+ private Status getStatus2() {
+ String urlString = url+"/_cluster/health";
+ try {
+ URL url = new URL(urlString);
+ URLConnection urlConnection = url.openConnection();
+ InputStream inputStream = urlConnection.getInputStream();
+ String line;
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ while ((line = reader.readLine()) != null) {
+ if (line.contains("\"status\"")) {
+ if (line.contains("\"red\"")) {
+ return Status.DOWN;
+ }
+ if (line.contains("\"yellow\"")) {
+ return Status.OPERATIONAL;
+ }
+ if (line.contains("\"green\"")) {
+ return Status.OPERATIONAL;
+ }
+ }
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
}
return Status.DOWN;
}
@@ -89,25 +172,29 @@ public class SearchServer implements Monitored {
@Override
public void awaitStop() {
try {
- while (node != null && !node.isClosed()) {
+ while (p != null && p.isAlive()) {
Thread.sleep(200L);
}
} catch (InterruptedException e) {
- // Restore the interrupted status
- Thread.currentThread().interrupt();
+ e.printStackTrace();
+ }
+
+ if (p != null) {
+ p.destroy();
+ try {
+ p.waitFor();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
}
@Override
public void stop() {
- if (node != null && !node.isClosed()) {
- try {
- node.close();
- } catch (IOException e) {
- LOGGER.error("Failed to stop ES cleanly", e);
- }
+ if (p != null) {
+ p.destroyForcibly();
}
- Jmx.unregister(EsSettingsMBean.OBJECT_NAME);
+ //Jmx.unregister(EsSettingsMBean.OBJECT_NAME);
}
public static void main(String... args) {
diff --git a/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java b/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java
index 9abbb3248b1..583dfdcb9b4 100644
--- a/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java
+++ b/server/sonar-search/src/test/java/org/sonar/search/EsSettingsTest.java
@@ -21,8 +21,8 @@ package org.sonar.search;
import java.io.File;
import java.io.IOException;
+import java.util.Map;
import java.util.Properties;
-import org.elasticsearch.common.settings.Settings;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -51,7 +51,7 @@ public class EsSettingsTest {
EsSettings esSettings = new EsSettings(props);
- Settings generated = esSettings.build();
+ Map<String, String> generated = esSettings.build();
assertThat(generated.get("transport.tcp.port")).isEqualTo("1234");
assertThat(generated.get("transport.host")).isEqualTo("127.0.0.1");
@@ -82,7 +82,7 @@ public class EsSettingsTest {
props.set(ProcessProperties.PATH_LOGS, logDir.getAbsolutePath());
props.set(ProcessProperties.PATH_TEMP, tempDir.getAbsolutePath());
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("path.data")).isEqualTo(new File(dataDir, "es").getAbsolutePath());
assertThat(settings.get("path.logs")).isEqualTo(logDir.getAbsolutePath());
@@ -93,7 +93,7 @@ public class EsSettingsTest {
public void cluster_is_enabled() throws Exception {
Props props = minProps(true);
props.set(ProcessProperties.CLUSTER_SEARCH_HOSTS, "1.2.3.4:9000,1.2.3.5:8080");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("index.number_of_replicas")).isEqualTo("1");
assertThat(settings.get("discovery.zen.ping.unicast.hosts")).isEqualTo("1.2.3.4:9000,1.2.3.5:8080");
@@ -108,14 +108,14 @@ public class EsSettingsTest {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Value of property sonar.search.minimumMasterNodes is not an integer:");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
}
@Test
public void cluster_is_enabled_with_defined_minimum_master_nodes() throws Exception {
Props props = minProps(true);
props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("5");
}
@@ -124,7 +124,7 @@ public class EsSettingsTest {
public void cluster_is_enabled_with_defined_initialTimeout() throws Exception {
Props props = minProps(true);
props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("10s");
}
@@ -133,7 +133,7 @@ public class EsSettingsTest {
public void in_standalone_initialTimeout_is_not_overridable() throws Exception {
Props props = minProps(false);
props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "10s");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("discovery.initial_state_timeout")).isEqualTo("30s");
}
@@ -142,7 +142,7 @@ public class EsSettingsTest {
public void in_standalone_minimumMasterNodes_is_not_overridable() throws Exception {
Props props = minProps(false);
props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "5");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("discovery.zen.minimum_master_nodes")).isEqualTo("1");
}
@@ -152,7 +152,7 @@ public class EsSettingsTest {
public void in_standalone_searchReplicas_is_not_overridable() throws Exception {
Props props = minProps(false);
props.set(ProcessProperties.SEARCH_REPLICAS, "5");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("index.number_of_replicas")).isEqualTo("0");
}
@@ -161,7 +161,7 @@ public class EsSettingsTest {
public void cluster_is_enabled_with_defined_replicas() throws Exception {
Props props = minProps(true);
props.set(ProcessProperties.SEARCH_REPLICAS, "5");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("index.number_of_replicas")).isEqualTo("5");
}
@@ -174,14 +174,14 @@ public class EsSettingsTest {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Value of property sonar.search.replicas is not an integer:");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
}
@Test
public void enable_marvel() throws Exception {
Props props = minProps(false);
props.set(EsSettings.PROP_MARVEL_HOSTS, "127.0.0.2,127.0.0.3");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("marvel.agent.exporter.es.hosts")).isEqualTo("127.0.0.2,127.0.0.3");
}
@@ -190,7 +190,7 @@ public class EsSettingsTest {
public void enable_http_connector() throws Exception {
Props props = minProps(false);
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("http.port")).isEqualTo("9010");
assertThat(settings.get("http.host")).isEqualTo("127.0.0.1");
@@ -202,7 +202,7 @@ public class EsSettingsTest {
Props props = minProps(false);
props.set(ProcessProperties.SEARCH_HTTP_PORT, "9010");
props.set(ProcessProperties.SEARCH_HOST, "127.0.0.2");
- Settings settings = new EsSettings(props).build();
+ Map<String, String> settings = new EsSettings(props).build();
assertThat(settings.get("http.port")).isEqualTo("9010");
assertThat(settings.get("http.host")).isEqualTo("127.0.0.2");
diff --git a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java
index a431475b741..5627c782598 100644
--- a/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java
+++ b/server/sonar-search/src/test/java/org/sonar/search/SearchServerTest.java
@@ -19,18 +19,14 @@
*/
package org.sonar.search;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.InetAddress;
-import java.util.Collection;
-import java.util.Collections;
+import java.net.URL;
+import java.net.URLConnection;
import java.util.Properties;
-import org.elasticsearch.client.Client;
-import org.elasticsearch.client.transport.NoNodeAvailableException;
-import org.elasticsearch.client.transport.TransportClient;
-import org.elasticsearch.cluster.health.ClusterHealthStatus;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.transport.InetSocketTransportAddress;
-import org.elasticsearch.plugins.Plugin;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
@@ -38,7 +34,6 @@ import org.junit.rules.DisableOnDebug;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
-import org.slf4j.Logger;
import org.sonar.process.Monitored;
import org.sonar.process.NetworkUtils;
import org.sonar.process.ProcessEntryPoint;
@@ -47,10 +42,6 @@ import org.sonar.process.Props;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class SearchServerTest {
@@ -63,8 +54,8 @@ public class SearchServerTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
+ private int httpPort = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
private int port = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
- private Client client;
private SearchServer underTest;
@After
@@ -73,68 +64,48 @@ public class SearchServerTest {
underTest.stop();
underTest.awaitStop();
}
- if (client != null) {
- client.close();
- }
- }
-
- @Test
- public void log_information_on_startup() throws IOException {
- Props props = getClusterProperties();
- props.set(ProcessProperties.CLUSTER_ENABLED, "true");
- props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "2");
- // Set the timeout to 1sec
- props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "1s");
- underTest = new SearchServer(props);
- Logger logger = mock(Logger.class);
- underTest.LOGGER = logger;
- underTest.start();
- System.out.println(org.apache.logging.log4j.Logger.class);
- verify(logger).info(eq("Elasticsearch is waiting {} for {} node(s) to be up to start."), eq("1s"), eq("2"));
- }
-
- @Test
- public void no_log_information_on_startup() throws IOException {
- Props props = getClusterProperties();
- props.set(ProcessProperties.SEARCH_MINIMUM_MASTER_NODES, "1");
- // Set the timeout to 1sec
- props.set(ProcessProperties.SEARCH_INITIAL_STATE_TIMEOUT, "1s");
- underTest = new SearchServer(props);
- Logger logger = mock(Logger.class);
- underTest.LOGGER = logger;
- underTest.start();
- verify(logger, never()).info(eq("Elasticsearch is waiting {} for {} node(s) to be up to start."), eq("1s"), eq("2"));
}
@Test
public void start_stop_server() throws Exception {
underTest = new SearchServer(getClusterProperties());
+
underTest.start();
assertThat(underTest.getStatus()).isEqualTo(Monitored.Status.OPERATIONAL);
- Settings settings = Settings.builder().put("cluster.name", A_CLUSTER_NAME).build();
- Collection<Class<? extends Plugin>> plugins = Collections.emptyList();
- client = new TransportClient(settings, plugins) {
-
- }.addTransportAddress(new InetSocketTransportAddress(InetAddress.getLoopbackAddress(), port));
- assertThat(client.admin().cluster().prepareClusterStats().get().getStatus()).isEqualTo(ClusterHealthStatus.GREEN);
-
underTest.stop();
underTest.awaitStop();
- underTest = null;
try {
- client.admin().cluster().prepareClusterStats().get();
+ underTest.getStatus();
fail();
- } catch (NoNodeAvailableException exception) {
+ } catch (Exception exception) {
// ok
}
}
+ private void waitFor(String expectedStatus) throws Exception {
+ String urlString = "http://localhost:" + httpPort + "/_cluster/health";
+ URL url = new URL(urlString);
+ URLConnection urlConnection = url.openConnection();
+ InputStream inputStream = urlConnection.getInputStream();
+ String line;
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ while ((line = reader.readLine()) != null) {
+ if (line.contains("\"status\"")) {
+ if (line.contains(expectedStatus)) {
+ return;
+ }
+ }
+ }
+ fail();
+ }
+
private Props getClusterProperties() throws IOException {
Props props = new Props(new Properties());
// the following properties have always default values (see ProcessProperties)
InetAddress host = InetAddress.getLoopbackAddress();
props.set(ProcessProperties.SEARCH_HOST, host.getHostAddress());
+ props.set(ProcessProperties.SEARCH_HTTP_PORT, String.valueOf(httpPort));
props.set(ProcessProperties.SEARCH_PORT, String.valueOf(port));
props.set(ProcessProperties.CLUSTER_NAME, A_CLUSTER_NAME);
props.set(EsSettings.CLUSTER_SEARCH_NODE_NAME, A_NODE_NAME);
diff --git a/server/sonar-server/pom.xml b/server/sonar-server/pom.xml
index 59edc4ed98d..322795f5f5f 100644
--- a/server/sonar-server/pom.xml
+++ b/server/sonar-server/pom.xml
@@ -24,12 +24,13 @@
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
@@ -152,6 +153,16 @@
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
+ <groupId>org.elasticsearch.client</groupId>
+ <artifactId>transport</artifactId>
+ <version>${elasticsearch.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.5.2</version>
+ </dependency>
+ <dependency>
<groupId>org.elasticsearch.test</groupId>
<artifactId>framework</artifactId>
<version>${elasticsearch.version}</version>
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/EsClientProvider.java b/server/sonar-server/src/main/java/org/sonar/server/es/EsClientProvider.java
index 8a2f6ed18c3..20ca3bfe8fb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/es/EsClientProvider.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/es/EsClientProvider.java
@@ -23,11 +23,11 @@ import com.google.common.net.HostAndPort;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
-import java.util.Collections;
import java.util.stream.Collectors;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
+import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.picocontainer.injectors.ProviderAdapter;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.config.Configuration;
@@ -55,13 +55,13 @@ public class EsClientProvider extends ProviderAdapter {
boolean clusterEnabled = config.getBoolean(ProcessProperties.CLUSTER_ENABLED).orElse(false);
if (clusterEnabled && config.getBoolean(ProcessProperties.CLUSTER_SEARCH_DISABLED).orElse(false)) {
esSettings.put("client.transport.sniff", true);
- nativeClient = new TransportClient(esSettings.build(), Collections.emptyList()) {};
+ nativeClient = new PreBuiltTransportClient(esSettings.build());
Arrays.stream(config.getStringArray(ProcessProperties.CLUSTER_SEARCH_HOSTS))
.map(HostAndPort::fromString)
.forEach(h -> addHostToClient(h, nativeClient));
LOGGER.info("Connected to remote Elasticsearch: [{}]", displayedAddresses(nativeClient));
} else {
- nativeClient = new TransportClient(esSettings.build(), Collections.emptyList()) {};
+ nativeClient = new PreBuiltTransportClient(esSettings.build());
HostAndPort host = HostAndPort.fromParts(config.get(ProcessProperties.SEARCH_HOST).get(), config.getInt(ProcessProperties.SEARCH_PORT).get());
addHostToClient(host, nativeClient);
LOGGER.info("Connected to local Elasticsearch: [{}]", displayedAddresses(nativeClient));
diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java
index 02f9a5ca018..80da6dd0457 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/es/IndexCreatorTest.java
@@ -22,6 +22,7 @@ package org.sonar.server.es;
import java.io.IOException;
import java.util.Map;
import javax.annotation.CheckForNull;
+import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.junit.Rule;
@@ -98,7 +99,7 @@ public class IndexCreatorTest {
IndexType fakeIndexType = new IndexType("fakes", "fake");
String id = "1";
- es.client().prepareIndex(fakeIndexType).setId(id).setSource(new FakeDoc().getFields()).setRefresh(true).get();
+ es.client().prepareIndex(fakeIndexType).setId(id).setSource(new FakeDoc().getFields()).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get();
assertThat(es.client().prepareGet(fakeIndexType, id).get().isExists()).isTrue();
// v2
diff --git a/sonar-application/assembly.xml b/sonar-application/assembly.xml
index bdb5076457e..5b523b7caee 100644
--- a/sonar-application/assembly.xml
+++ b/sonar-application/assembly.xml
@@ -154,6 +154,8 @@
<include>bin/*/lib/*.dll</include>
<include>bin/*/wrapper</include>
<include>bin/*/wrapper.exe</include>
+ <include>elasticsearch/bin/elasticsearch</include>
+ <include>elasticsearch/bin/elasticsearch.bat</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index 3eb3ee72e35..dc357b09915 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -242,8 +242,8 @@
<configuration>
<rules>
<requireFilesSize>
- <minsize>136000000</minsize>
- <maxsize>144000000</maxsize>
+ <minsize>178000000</minsize>
+ <maxsize>186000000</maxsize>
<files>
<file>${project.build.directory}/sonarqube-${project.version}.zip</file>
</files>
diff --git a/sonar-application/src/main/assembly/elasticsearch/LICENSE.txt b/sonar-application/src/main/assembly/elasticsearch/LICENSE.txt
new file mode 100644
index 00000000000..d6456956733
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/sonar-application/src/main/assembly/elasticsearch/NOTICE.txt b/sonar-application/src/main/assembly/elasticsearch/NOTICE.txt
new file mode 100644
index 00000000000..c99b9581931
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/NOTICE.txt
@@ -0,0 +1,5 @@
+Elasticsearch
+Copyright 2009-2016 Elasticsearch
+
+This product includes software developed by The Apache Software
+Foundation (http://www.apache.org/).
diff --git a/sonar-application/src/main/assembly/elasticsearch/README.textile b/sonar-application/src/main/assembly/elasticsearch/README.textile
new file mode 100644
index 00000000000..52c7607509c
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/README.textile
@@ -0,0 +1,238 @@
+h1. Elasticsearch
+
+h2. A Distributed RESTful Search Engine
+
+h3. "https://www.elastic.co/products/elasticsearch":https://www.elastic.co/products/elasticsearch
+
+Elasticsearch is a distributed RESTful search engine built for the cloud. Features include:
+
+* Distributed and Highly Available Search Engine.
+** Each index is fully sharded with a configurable number of shards.
+** Each shard can have one or more replicas.
+** Read / Search operations performed on any of the replica shards.
+* Multi Tenant with Multi Types.
+** Support for more than one index.
+** Support for more than one type per index.
+** Index level configuration (number of shards, index storage, ...).
+* Various set of APIs
+** HTTP RESTful API
+** Native Java API.
+** All APIs perform automatic node operation rerouting.
+* Document oriented
+** No need for upfront schema definition.
+** Schema can be defined per type for customization of the indexing process.
+* Reliable, Asynchronous Write Behind for long term persistency.
+* (Near) Real Time Search.
+* Built on top of Lucene
+** Each shard is a fully functional Lucene index
+** All the power of Lucene easily exposed through simple configuration / plugins.
+* Per operation consistency
+** Single document level operations are atomic, consistent, isolated and durable.
+* Open Source under the Apache License, version 2 ("ALv2")
+
+h2. Getting Started
+
+First of all, DON'T PANIC. It will take 5 minutes to get the gist of what Elasticsearch is all about.
+
+h3. Requirements
+
+You need to have a recent version of Java installed. See the "Setup":http://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#jvm-version page for more information.
+
+h3. Installation
+
+* "Download":https://www.elastic.co/downloads/elasticsearch and unzip the Elasticsearch official distribution.
+* Run @bin/elasticsearch@ on unix, or @bin\elasticsearch.bat@ on windows.
+* Run @curl -X GET http://localhost:9200/@.
+* Start more servers ...
+
+h3. Indexing
+
+Let's try and index some twitter like information. First, let's create a twitter user, and add some tweets (the @twitter@ index will be created automatically):
+
+<pre>
+curl -XPUT 'http://localhost:9200/twitter/user/kimchy?pretty' -d '{ "name" : "Shay Banon" }'
+
+curl -XPUT 'http://localhost:9200/twitter/tweet/1?pretty' -d '
+{
+ "user": "kimchy",
+ "post_date": "2009-11-15T13:12:00",
+ "message": "Trying out Elasticsearch, so far so good?"
+}'
+
+curl -XPUT 'http://localhost:9200/twitter/tweet/2?pretty' -d '
+{
+ "user": "kimchy",
+ "post_date": "2009-11-15T14:12:12",
+ "message": "Another tweet, will it be indexed?"
+}'
+</pre>
+
+Now, let's see if the information was added by GETting it:
+
+<pre>
+curl -XGET 'http://localhost:9200/twitter/user/kimchy?pretty=true'
+curl -XGET 'http://localhost:9200/twitter/tweet/1?pretty=true'
+curl -XGET 'http://localhost:9200/twitter/tweet/2?pretty=true'
+</pre>
+
+h3. Searching
+
+Mmm search..., shouldn't it be elastic?
+Let's find all the tweets that @kimchy@ posted:
+
+<pre>
+curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=user:kimchy&pretty=true'
+</pre>
+
+We can also use the JSON query language Elasticsearch provides instead of a query string:
+
+<pre>
+curl -XGET 'http://localhost:9200/twitter/tweet/_search?pretty=true' -d '
+{
+ "query" : {
+ "match" : { "user": "kimchy" }
+ }
+}'
+</pre>
+
+Just for kicks, let's get all the documents stored (we should see the user as well):
+
+<pre>
+curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
+{
+ "query" : {
+ "match_all" : {}
+ }
+}'
+</pre>
+
+We can also do range search (the @postDate@ was automatically identified as date)
+
+<pre>
+curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -d '
+{
+ "query" : {
+ "range" : {
+ "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" }
+ }
+ }
+}'
+</pre>
+
+There are many more options to perform search, after all, it's a search product no? All the familiar Lucene queries are available through the JSON query language, or through the query parser.
+
+h3. Multi Tenant - Indices and Types
+
+Maan, that twitter index might get big (in this case, index size == valuation). Let's see if we can structure our twitter system a bit differently in order to support such large amounts of data.
+
+Elasticsearch supports multiple indices, as well as multiple types per index. In the previous example we used an index called @twitter@, with two types, @user@ and @tweet@.
+
+Another way to define our simple twitter system is to have a different index per user (note, though that each index has an overhead). Here is the indexing curl's in this case:
+
+<pre>
+curl -XPUT 'http://localhost:9200/kimchy/info/1?pretty' -d '{ "name" : "Shay Banon" }'
+
+curl -XPUT 'http://localhost:9200/kimchy/tweet/1?pretty' -d '
+{
+ "user": "kimchy",
+ "post_date": "2009-11-15T13:12:00",
+ "message": "Trying out Elasticsearch, so far so good?"
+}'
+
+curl -XPUT 'http://localhost:9200/kimchy/tweet/2?pretty' -d '
+{
+ "user": "kimchy",
+ "post_date": "2009-11-15T14:12:12",
+ "message": "Another tweet, will it be indexed?"
+}'
+</pre>
+
+The above will index information into the @kimchy@ index, with two types, @info@ and @tweet@. Each user will get their own special index.
+
+Complete control on the index level is allowed. As an example, in the above case, we would want to change from the default 5 shards with 1 replica per index, to only 1 shard with 1 replica per index (== per twitter user). Here is how this can be done (the configuration can be in yaml as well):
+
+<pre>
+curl -XPUT http://localhost:9200/another_user?pretty -d '
+{
+ "index" : {
+ "number_of_shards" : 1,
+ "number_of_replicas" : 1
+ }
+}'
+</pre>
+
+Search (and similar operations) are multi index aware. This means that we can easily search on more than one
+index (twitter user), for example:
+
+<pre>
+curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -d '
+{
+ "query" : {
+ "match_all" : {}
+ }
+}'
+</pre>
+
+Or on all the indices:
+
+<pre>
+curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
+{
+ "query" : {
+ "match_all" : {}
+ }
+}'
+</pre>
+
+{One liner teaser}: And the cool part about that? You can easily search on multiple twitter users (indices), with different boost levels per user (index), making social search so much simpler (results from my friends rank higher than results from friends of my friends).
+
+h3. Distributed, Highly Available
+
+Let's face it, things will fail....
+
+Elasticsearch is a highly available and distributed search engine. Each index is broken down into shards, and each shard can have one or more replica. By default, an index is created with 5 shards and 1 replica per shard (5/1). There are many topologies that can be used, including 1/10 (improve search performance), or 20/1 (improve indexing performance, with search executed in a map reduce fashion across shards).
+
+In order to play with the distributed nature of Elasticsearch, simply bring more nodes up and shut down nodes. The system will continue to serve requests (make sure you use the correct http port) with the latest data indexed.
+
+h3. Where to go from here?
+
+We have just covered a very small portion of what Elasticsearch is all about. For more information, please refer to the "elastic.co":http://www.elastic.co/products/elasticsearch website. General questions can be asked on the "Elastic Discourse forum":https://discuss.elastic.co or on IRC on Freenode at "#elasticsearch":https://webchat.freenode.net/#elasticsearch. The Elasticsearch GitHub repository is reserved for bug reports and feature requests only.
+
+h3. Building from Source
+
+Elasticsearch uses "Gradle":https://gradle.org for its build system. You'll need to have version 2.13 of Gradle installed.
+
+In order to create a distribution, simply run the @gradle assemble@ command in the cloned directory.
+
+The distribution for each project will be created under the @build/distributions@ directory in that project.
+
+See the "TESTING":TESTING.asciidoc file for more information about
+running the Elasticsearch test suite.
+
+h3. Upgrading from Elasticsearch 1.x?
+
+In order to ensure a smooth upgrade process from earlier versions of
+Elasticsearch (1.x), it is required to perform a full cluster restart. Please
+see the "setup reference":
+https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html
+for more details on the upgrade process.
+
+h1. License
+
+<pre>
+This software is licensed under the Apache License, version 2 ("ALv2"), quoted below.
+
+Copyright 2009-2016 Elasticsearch <https://www.elastic.co>
+
+Licensed 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.
+</pre>
diff --git a/sonar-application/src/main/assembly/elasticsearch/VERSION.txt b/sonar-application/src/main/assembly/elasticsearch/VERSION.txt
new file mode 100644
index 00000000000..f373200c34f
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/VERSION.txt
@@ -0,0 +1,2 @@
+Elasticsearch 5.0.2
+https://www.elastic.co/downloads/past-releases/elasticsearch-5-0-2
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch
new file mode 100755
index 00000000000..57d9d38784e
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch
@@ -0,0 +1,200 @@
+#!/bin/bash
+
+# CONTROLLING STARTUP:
+#
+# This script relies on few environment variables to determine startup
+# behavior, those variables are:
+#
+# ES_CLASSPATH -- A Java classpath containing everything necessary to run.
+# ES_JVM_OPTIONS -- Path to file containing JVM options
+# ES_JAVA_OPTS -- External Java Opts on top of the defaults set
+#
+# Optionally, exact memory values can be set using the `ES_JAVA_OPTS`.
+# Note that the Xms and Xmx lines in the JVM options file must be
+# commented out. Sample format include "512m", and "10g".
+#
+# ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch
+#
+# As a convenience, a fragment of shell is sourced in order to set one or
+# more of these variables. This so-called `include' can be placed in a
+# number of locations and will be searched for in order. The lowest
+# priority search path is the same directory as the startup script, and
+# since this is the location of the sample in the project tree, it should
+# almost work Out Of The Box.
+#
+# Any serious use-case though will likely require customization of the
+# include. For production installations, it is recommended that you copy
+# the sample to one of /usr/share/elasticsearch/elasticsearch.in.sh,
+# /usr/local/share/elasticsearch/elasticsearch.in.sh, or
+# /opt/elasticsearch/elasticsearch.in.sh and make your modifications there.
+#
+# Another option is to specify the full path to the include file in the
+# environment. For example:
+#
+# $ ES_INCLUDE=/path/to/in.sh elasticsearch -p /var/run/es.pid
+#
+# Note: This is particularly handy for running multiple instances on a
+# single installation, or for quick tests.
+#
+# If you would rather configure startup entirely from the environment, you
+# can disable the include by exporting an empty ES_INCLUDE, or by
+# ensuring that no include files exist in the aforementioned search list.
+# Be aware that you will be entirely responsible for populating the needed
+# environment variables.
+
+# Check to see if you are trying to run this without building it first. Gradle
+# will replace the project.name with _something_.
+
+if echo 'distribution' | grep project.name > /dev/null ; then
+ cat >&2 << EOF
+Error: You must build the project with Gradle or download a pre-built package
+before you can run Elasticsearch. See 'Building from Source' in README.textile
+or visit https://www.elastic.co/download to get a pre-built package.
+EOF
+ exit 1
+fi
+
+# TODO: remove for Elasticsearch 6.x
+unsupported_environment_variable() {
+ if test -n "$1"; then
+ echo "$2=$1: $3"
+ fi
+}
+
+if test -n "$ES_MIN_MEM" ||
+ test -n "$ES_MAX_MEM" ||
+ test -n "$ES_HEAP_SIZE" ||
+ test -n "$ES_HEAP_NEWSIZE" ||
+ test -n "$ES_DIRECT_SIZE" ||
+ test -n "$ES_USE_IPV4" ||
+ test -n "$ES_GC_OPTS" ||
+ test -n "$ES_GC_LOG_FILE"; then
+ echo "Error: encountered environment variables that are no longer supported"
+ echo "Use jvm.options or ES_JAVA_OPTS to configure the JVM"
+ unsupported_environment_variable "$ES_MIN_MEM" ES_MIN_MEM "set -Xms$ES_MIN_MEM in jvm.options or add \"-Xms$ES_MIN_MEM\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_MAX_MEM" ES_MAX_MEM "set -Xmx$ES_MAX_MEM in jvm.options or add \"-Xmx$ES_MAX_MEM\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_HEAP_SIZE" ES_HEAP_SIZE "set -Xms$ES_HEAP_SIZE and -Xmx$ES_HEAP_SIZE in jvm.options or add \"-Xms$ES_HEAP_SIZE -Xmx$ES_HEAP_SIZE\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_HEAP_NEWSIZE" ES_HEAP_NEWSIZE "set -Xmn$ES_HEAP_NEWSIZE in jvm.options or add \"-Xmn$ES_HEAP_SIZE\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_DIRECT_SIZE" ES_DIRECT_SIZE "set -XX:MaxDirectMemorySize=$ES_DIRECT_SIZE in jvm.options or add \"-XX:MaxDirectMemorySize=$ES_DIRECT_SIZE\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_USE_IPV4" ES_USE_IPV4 "set -Djava.net.preferIPv4Stack=true in jvm.options or add \"-Djava.net.preferIPv4Stack=true\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_GC_OPTS" ES_GC_OPTS "set ${ES_GC_OPTS// / and } in jvm.options or add \"$ES_GC_OPTS\" to ES_JAVA_OPTS"
+ unsupported_environment_variable "$ES_GC_LOG_FILE" ES_GC_LOG_FILE "set -Xloggc:$ES_GC_LOG_FILE in jvm.options or add \"-Xloggc:$ES_GC_LOG_FILE\" to ES_JAVA_OPTS"
+ exit 1
+fi
+# end TODO: remove for Elasticsearch 6.x
+
+parse_jvm_options() {
+ if [ -f "$1" ]; then
+ echo "$(grep "^-" "$1" | tr '\n' ' ')"
+ fi
+}
+
+CDPATH=""
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+# determine elasticsearch home
+ES_HOME=`dirname "$SCRIPT"`/..
+
+# make ELASTICSEARCH_HOME absolute
+ES_HOME=`cd "$ES_HOME"; pwd`
+
+if [ -z "$ES_JVM_OPTIONS" ]; then
+ for jvm_options in "$ES_HOME"/config/jvm.options \
+ /etc/elasticsearch/jvm.options; do
+ if [ -r "$jvm_options" ]; then
+ ES_JVM_OPTIONS=$jvm_options
+ break
+ fi
+ done
+fi
+
+ES_JAVA_OPTS="$(parse_jvm_options "$ES_JVM_OPTIONS") $ES_JAVA_OPTS"
+
+# If an include wasn't specified in the environment, then search for one...
+if [ "x$ES_INCLUDE" = "x" ]; then
+ # Locations (in order) to use when searching for an include file.
+ for include in /usr/share/elasticsearch/elasticsearch.in.sh \
+ /usr/local/share/elasticsearch/elasticsearch.in.sh \
+ /opt/elasticsearch/elasticsearch.in.sh \
+ ~/.elasticsearch.in.sh \
+ "$ES_HOME/bin/elasticsearch.in.sh" \
+ "`dirname "$0"`"/elasticsearch.in.sh; do
+ if [ -r "$include" ]; then
+ . "$include"
+ break
+ fi
+ done
+# ...otherwise, source the specified include.
+elif [ -r "$ES_INCLUDE" ]; then
+ . "$ES_INCLUDE"
+fi
+
+if [ -x "$JAVA_HOME/bin/java" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+else
+ JAVA=`which java`
+fi
+
+if [ ! -x "$JAVA" ]; then
+ echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
+ exit 1
+fi
+
+if [ -z "$ES_CLASSPATH" ]; then
+ echo "You must set the ES_CLASSPATH var" >&2
+ exit 1
+fi
+
+# don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu)
+# works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487
+if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then
+ echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS"
+ echo "Please pass JVM parameters via ES_JAVA_OPTS instead"
+ unset JAVA_TOOL_OPTIONS
+fi
+
+# JAVA_OPTS is not a built-in JVM mechanism but some people think it is
+# so let us warn them that we are not observing the value of $JAVA_OPTS
+if [ "x$JAVA_OPTS" != "x" ]; then
+ echo "Warning: Ignoring JAVA_OPTS=$JAVA_OPTS"
+ echo "Please pass JVM parameters via ES_JAVA_OPTS instead"
+fi
+
+# full hostname passed through cut for portability on systems that do not support hostname -s
+# export on separate line for shells that do not support combining definition and export
+HOSTNAME=`hostname | cut -d. -f1`
+export HOSTNAME
+
+# manual parsing to find out, if process should be detached
+daemonized=`echo $* | egrep -- '(^-d |-d$| -d |--daemonize$|--daemonize )'`
+if [ -z "$daemonized" ] ; then
+ exec "$JAVA" $ES_JAVA_OPTS -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" \
+ org.elasticsearch.bootstrap.Elasticsearch "$@"
+else
+ exec "$JAVA" $ES_JAVA_OPTS -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" \
+ org.elasticsearch.bootstrap.Elasticsearch "$@" <&- &
+ retval=$?
+ pid=$!
+ [ $retval -eq 0 ] || exit $retval
+ if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
+ sleep $ES_STARTUP_SLEEP_TIME
+ fi
+ if ! ps -p $pid > /dev/null ; then
+ exit 1
+ fi
+ exit 0
+fi
+
+exit $?
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin
new file mode 100755
index 00000000000..77d83afe14e
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+CDPATH=""
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+# determine elasticsearch home
+ES_HOME=`dirname "$SCRIPT"`/..
+
+# make ELASTICSEARCH_HOME absolute
+ES_HOME=`cd "$ES_HOME"; pwd`
+
+
+# Sets the default values for elasticsearch variables used in this script
+if [ -z "$CONF_DIR" ]; then
+ CONF_DIR="$ES_HOME/config"
+fi
+
+# The default env file is defined at building/packaging time.
+# For a distribution package, the value is "".
+ES_ENV_FILE=""
+
+# If an include is specified with the ES_INCLUDE environment variable, use it
+if [ -n "$ES_INCLUDE" ]; then
+ ES_ENV_FILE="$ES_INCLUDE"
+fi
+
+# Source the environment file
+if [ -n "$ES_ENV_FILE" ]; then
+
+ # If the ES_ENV_FILE is not found, try to resolve the path
+ # against the ES_HOME directory
+ if [ ! -f "$ES_ENV_FILE" ]; then
+ ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE"
+ fi
+
+ . "$ES_ENV_FILE"
+ if [ $? -ne 0 ]; then
+ echo "Unable to source environment file: $ES_ENV_FILE" >&2
+ exit 1
+ fi
+fi
+
+# don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu)
+# works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487
+if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then
+ echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS"
+ unset JAVA_TOOL_OPTIONS
+fi
+
+# CONF_FILE setting was removed
+if [ ! -z "$CONF_FILE" ]; then
+ echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed."
+ exit 1
+fi
+
+if [ -x "$JAVA_HOME/bin/java" ]; then
+ JAVA=$JAVA_HOME/bin/java
+else
+ JAVA=`which java`
+fi
+
+if [ ! -x "$JAVA" ]; then
+ echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
+ exit 1
+fi
+
+# full hostname passed through cut for portability on systems that do not support hostname -s
+# export on separate line for shells that do not support combining definition and export
+HOSTNAME=`hostname | cut -d. -f1`
+export HOSTNAME
+
+declare -a args=("$@")
+path_props=(-Des.path.home="$ES_HOME")
+
+if [ -e "$CONF_DIR" ]; then
+ path_props=("${path_props[@]}" -Des.path.conf="$CONF_DIR")
+fi
+
+exec "$JAVA" $ES_JAVA_OPTS -Delasticsearch "${path_props[@]}" -cp "$ES_HOME/lib/*" org.elasticsearch.plugins.PluginCli "${args[@]}"
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin.bat b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin.bat
new file mode 100644
index 00000000000..b2c87d1627c
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-plugin.bat
@@ -0,0 +1,30 @@
+@echo off
+
+SETLOCAL enabledelayedexpansion
+
+IF DEFINED JAVA_HOME (
+ set JAVA=%JAVA_HOME%\bin\java.exe
+) ELSE (
+ FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
+)
+IF NOT EXIST "%JAVA%" (
+ ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2
+ EXIT /B 1
+)
+
+set SCRIPT_DIR=%~dp0
+for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI
+
+TITLE Elasticsearch Plugin Manager 5.0.2
+
+SET path_props=-Des.path.home="%ES_HOME%"
+IF DEFINED CONF_DIR (
+ SET path_props=!path_props! -Des.path.conf="%CONF_DIR%"
+)
+
+SET args=%*
+SET HOSTNAME=%COMPUTERNAME%
+
+"%JAVA%" %ES_JAVA_OPTS% !path_props! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.plugins.PluginCli" !args!
+
+ENDLOCAL
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-mgr.exe b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-mgr.exe
new file mode 100644
index 00000000000..730240403a7
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-mgr.exe
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x64.exe b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x64.exe
new file mode 100644
index 00000000000..dab7def7558
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x64.exe
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x86.exe b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x86.exe
new file mode 100644
index 00000000000..4240720018b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service-x86.exe
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service.bat b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service.bat
new file mode 100644
index 00000000000..9c46c376d93
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-service.bat
@@ -0,0 +1,349 @@
+@echo off
+SETLOCAL enabledelayedexpansion
+
+TITLE Elasticsearch Service 5.0.2
+
+rem TODO: remove for Elasticsearch 6.x
+set bad_env_var=0
+if not "%ES_MIN_MEM%" == "" set bad_env_var=1
+if not "%ES_MAX_MEM%" == "" set bad_env_var=1
+if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1
+if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1
+if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1
+if not "%ES_USE_IPV4%" == "" set bad_env_var=1
+if not "%ES_GC_OPTS%" == "" set bad_env_var=1
+if not "%ES_GC_LOG_FILE%" == "" set bad_env_var=1
+if %bad_env_var% == 1 (
+ echo Error: encountered environment variables that are no longer supported
+ echo Use jvm.options or ES_JAVA_OPTS to configure the JVM
+ if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM%: set -Xms%ES_MIN_MEM% in jvm.options or add "-Xms%ES_MIN_MEM%" to ES_JAVA_OPTS
+ if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM%: set -Xms%ES_MAX_MEM% in jvm.options or add "-Xmx%ES_MAX_MEM%" to ES_JAVA_OPTS
+ if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE%: set -Xms%ES_HEAP_SIZE% and -Xmx%ES_HEAP_SIZE% in jvm.options or add "-Xms%ES_HEAP_SIZE% -Xmx%ES_HEAP_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE%: set -Xmn%ES_HEAP_NEWSIZE% in jvm.options or add "-Xmn%ES_HEAP_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE%: set -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE% in jvm.options or add "-XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4%: set -Djava.net.preferIPv4Stack=true in jvm.options or add "-Djava.net.preferIPv4Stack=true" to ES_JAVA_OPTS
+ if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS%: set %ES_GC_OPTS: = and % in jvm.options or add "%ES_GC_OPTS%" to ES_JAVA_OPTS
+ if not "%ES_GC_LOG_FILE%" == "" echo ES_GC_LOG_FILE=%ES_GC_LOG_FILE%: set -Xloggc:%ES_GC_LOG_FILE% in jvm.options or add "-Xloggc:%ES_GC_LOG_FILE%" to ES_JAVA_OPTS"
+ exit /b 1
+)
+rem end TODO: remove for Elasticsearch 6.x
+
+IF DEFINED JAVA_HOME (
+ SET JAVA=%JAVA_HOME%\bin\java.exe
+) ELSE (
+ FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
+)
+IF NOT EXIST "%JAVA%" (
+ ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2
+ EXIT /B 1
+)
+IF DEFINED JAVA_HOME GOTO :cont
+
+IF NOT "%JAVA:~-13%" == "\bin\java.exe" (
+ FOR /f "tokens=2 delims=[]" %%I IN ('dir %JAVA%') DO @set JAVA=%%I
+)
+IF "%JAVA:~-13%" == "\bin\java.exe" (
+ SET JAVA_HOME=%JAVA:~0,-13%
+)
+
+:cont
+if not "%CONF_FILE%" == "" goto conffileset
+
+set SCRIPT_DIR=%~dp0
+for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI
+
+"%JAVA%" -Xmx50M -version > nul 2>&1
+
+if errorlevel 1 (
+ echo Warning: Could not start JVM to detect version, defaulting to x86:
+ goto x86
+)
+
+"%JAVA%" -Xmx50M -version 2>&1 | "%windir%\System32\find" "64-Bit" >nul:
+
+if errorlevel 1 goto x86
+set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x64.exe
+set SERVICE_ID=elasticsearch-service-x64
+set ARCH=64-bit
+goto checkExe
+
+:x86
+set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x86.exe
+set SERVICE_ID=elasticsearch-service-x86
+set ARCH=32-bit
+
+:checkExe
+if EXIST "%EXECUTABLE%" goto okExe
+echo elasticsearch-service-(x86|x64).exe was not found...
+
+:okExe
+set ES_VERSION=5.0.2
+
+if "%LOG_DIR%" == "" set LOG_DIR=%ES_HOME%\logs
+
+if "x%1x" == "xx" goto displayUsage
+set SERVICE_CMD=%1
+shift
+if "x%1x" == "xx" goto checkServiceCmd
+set SERVICE_ID=%1
+
+:checkServiceCmd
+
+if "%LOG_OPTS%" == "" set LOG_OPTS=--LogPath "%LOG_DIR%" --LogPrefix "%SERVICE_ID%" --StdError auto --StdOutput auto
+
+if /i %SERVICE_CMD% == install goto doInstall
+if /i %SERVICE_CMD% == remove goto doRemove
+if /i %SERVICE_CMD% == start goto doStart
+if /i %SERVICE_CMD% == stop goto doStop
+if /i %SERVICE_CMD% == manager goto doManagment
+echo Unknown option "%SERVICE_CMD%"
+
+:displayUsage
+echo.
+echo Usage: elasticsearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID]
+goto:eof
+
+:doStart
+"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
+if not errorlevel 1 goto started
+echo Failed starting '%SERVICE_ID%' service
+goto:eof
+:started
+echo The service '%SERVICE_ID%' has been started
+goto:eof
+
+:doStop
+"%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS%
+if not errorlevel 1 goto stopped
+echo Failed stopping '%SERVICE_ID%' service
+goto:eof
+:stopped
+echo The service '%SERVICE_ID%' has been stopped
+goto:eof
+
+:doManagment
+set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr.exe
+"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
+if not errorlevel 1 goto managed
+echo Failed starting service manager for '%SERVICE_ID%'
+goto:eof
+:managed
+echo Successfully started service manager for '%SERVICE_ID%'.
+goto:eof
+
+:doRemove
+rem Remove the service
+"%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS%
+if not errorlevel 1 goto removed
+echo Failed removing '%SERVICE_ID%' service
+goto:eof
+:removed
+echo The service '%SERVICE_ID%' has been removed
+goto:eof
+
+:doInstall
+echo Installing service : "%SERVICE_ID%"
+echo Using JAVA_HOME (%ARCH%): "%JAVA_HOME%"
+
+rem Check JVM server dll first
+if exist "%JAVA_HOME%"\jre\bin\server\jvm.dll (
+ set JVM_DLL=\jre\bin\server\jvm.dll
+ goto foundJVM
+)
+
+rem Check 'server' JRE (JRE installed on Windows Server)
+if exist "%JAVA_HOME%"\bin\server\jvm.dll (
+ set JVM_DLL=\bin\server\jvm.dll
+ goto foundJVM
+)
+
+rem Fallback to 'client' JRE
+if exist "%JAVA_HOME%"\bin\client\jvm.dll (
+ set JVM_DLL=\bin\client\jvm.dll
+ echo Warning: JAVA_HOME points to a JRE and not JDK installation; a client (not a server^) JVM will be used...
+) else (
+ echo JAVA_HOME points to an invalid Java installation (no jvm.dll found in "%JAVA_HOME%"^). Exiting...
+ goto:eof
+)
+
+:foundJVM
+if "%ES_JVM_OPTIONS%" == "" (
+set ES_JVM_OPTIONS=%ES_HOME%\config\jvm.options
+)
+
+if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;%
+
+@setlocal
+for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%" ^| findstr /b /v "\-server \-client"`) do set JVM_OPTIONS=!JVM_OPTIONS!%%a;
+@endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS%%ES_JAVA_OPTS%
+
+if "%ES_JAVA_OPTS:~-1%"==";" set ES_JAVA_OPTS=%ES_JAVA_OPTS:~0,-1%
+
+@setlocal EnableDelayedExpansion
+for %%a in ("%ES_JAVA_OPTS:;=","%") do (
+ set var=%%a
+ if "!var:~1,4!" == "-Xms" (
+ if not "!JVM_MS!" == "" (
+ echo duplicate min heap size settings found
+ goto:eof
+ )
+ set XMS=!var:~5,-1!
+ call:convertxm !XMS! JVM_MS
+ )
+ if "!var:~1,16!" == "-XX:MinHeapSize=" (
+ if not "!JVM_MS!" == "" (
+ echo duplicate min heap size settings found
+ goto:eof
+ )
+ set XMS=!var:~17,-1!
+ call:convertxm !XMS! JVM_MS
+ )
+ if "!var:~1,4!" == "-Xmx" (
+ if not "!JVM_MX!" == "" (
+ echo duplicate max heap size settings found
+ goto:eof
+ )
+ set XMX=!var:~5,-1!
+ call:convertxm !XMX! JVM_MX
+ )
+ if "!var:~1,16!" == "-XX:MaxHeapSize=" (
+ if not "!JVM_MX!" == "" (
+ echo duplicate max heap size settings found
+ goto:eof
+ )
+ set XMX=!var:~17,-1!
+ call:convertxm !XMX! JVM_MX
+ )
+ if "!var:~1,4!" == "-Xss" (
+ if not "!JVM_SS!" == "" (
+ echo duplicate thread stack size settings found
+ exit 1
+ )
+ set XSS=!var:~5,-1!
+ call:convertxk !XSS! JVM_SS
+ )
+ if "!var:~1,20!" == "-XX:ThreadStackSize=" (
+ if not "!JVM_SS!" == "" (
+ echo duplicate thread stack size settings found
+ goto:eof
+ )
+ set XSS=!var:~21,-1!
+ call:convertxk !XSS! JVM_SS
+ )
+)
+@endlocal & set JVM_MS=%JVM_MS% & set JVM_MX=%JVM_MX% & set JVM_SS=%JVM_SS%
+
+if "%JVM_MS%" == "" (
+ echo minimum heap size not set; configure using -Xms via %ES_JVM_OPTIONS% or ES_JAVA_OPTS
+ goto:eof
+)
+if "%JVM_MX%" == "" (
+ echo maximum heap size not set; configure using -Xmx via %ES_JVM_OPTIONS% or ES_JAVA_OPTS
+ goto:eof
+)
+if "%JVM_SS%" == "" (
+ echo thread stack size not set; configure using -Xss via %ES_JVM_OPTIONS% or ES_JAVA_OPTS
+ goto:eof
+)
+
+CALL "%ES_HOME%\bin\elasticsearch.in.bat"
+if "%DATA_DIR%" == "" set DATA_DIR=%ES_HOME%\data
+
+if "%CONF_DIR%" == "" set CONF_DIR=%ES_HOME%\config
+
+set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.default.path.logs="%LOG_DIR%";-Des.default.path.data="%DATA_DIR%";-Des.default.path.conf="%CONF_DIR%"
+
+if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
+if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0
+
+if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=Elasticsearch %ES_VERSION% (%SERVICE_ID%)
+if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=Elasticsearch %ES_VERSION% Windows Service - https://elastic.co
+
+if not "%SERVICE_USERNAME%" == "" (
+ if not "%SERVICE_PASSWORD%" == "" (
+ set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%"
+ )
+)
+
+"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %ES_START_TYPE% --StopTimeout %ES_STOP_TIMEOUT% --StartClass org.elasticsearch.bootstrap.Elasticsearch --StopClass org.elasticsearch.bootstrap.Elasticsearch --StartMethod main --StopMethod close --Classpath "%ES_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %ES_JAVA_OPTS% ++JvmOptions %ES_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%%JAVA_HOME%%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%ES_HOME%" %SERVICE_PARAMS%
+
+if not errorlevel 1 goto installed
+echo Failed installing '%SERVICE_ID%' service
+goto:eof
+
+:installed
+echo The service '%SERVICE_ID%' has been installed.
+goto:eof
+
+:err
+echo JAVA_HOME environment variable must be set!
+pause
+goto:eof
+
+rem ---
+rem Function for converting Xm[s|x] values into MB which Commons Daemon accepts
+rem ---
+:convertxm
+set value=%~1
+rem extract last char (unit)
+set unit=%value:~-1%
+rem assume the unit is specified
+set conv=%value:~0,-1%
+
+if "%unit%" == "k" goto kilo
+if "%unit%" == "K" goto kilo
+if "%unit%" == "m" goto mega
+if "%unit%" == "M" goto mega
+if "%unit%" == "g" goto giga
+if "%unit%" == "G" goto giga
+
+rem no unit found, must be bytes; consider the whole value
+set conv=%value%
+rem convert to KB
+set /a conv=%conv% / 1024
+:kilo
+rem convert to MB
+set /a conv=%conv% / 1024
+goto mega
+:giga
+rem convert to MB
+set /a conv=%conv% * 1024
+:mega
+set "%~2=%conv%"
+goto:eof
+
+:convertxk
+set value=%~1
+rem extract last char (unit)
+set unit=%value:~-1%
+rem assume the unit is specified
+set conv=%value:~0,-1%
+
+if "%unit%" == "k" goto kilo
+if "%unit%" == "K" goto kilo
+if "%unit%" == "m" goto mega
+if "%unit%" == "M" goto mega
+if "%unit%" == "g" goto giga
+if "%unit%" == "G" goto giga
+
+rem no unit found, must be bytes; consider the whole value
+set conv=%value%
+rem convert to KB
+set /a conv=%conv% / 1024
+goto kilo
+:mega
+rem convert to KB
+set /a conv=%conv% * 1024
+goto kilo
+:giga
+rem convert to KB
+set /a conv=%conv% * 1024 * 1024
+:kilo
+set "%~2=%conv%"
+goto:eof
+
+:conffileset
+echo CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed.
+goto:eof
+
+ENDLOCAL
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-systemd-pre-exec b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-systemd-pre-exec
new file mode 100755
index 00000000000..5a5877598e6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-systemd-pre-exec
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# CONF_FILE setting was removed
+if [ ! -z "$CONF_FILE" ]; then
+ echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed."
+ exit 1
+fi
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog
new file mode 100755
index 00000000000..c1be8080044
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+CDPATH=""
+SCRIPT="$0"
+
+# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ # Drop everything prior to ->
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+# determine elasticsearch home
+ES_HOME=`dirname "$SCRIPT"`/..
+
+# make ELASTICSEARCH_HOME absolute
+ES_HOME=`cd "$ES_HOME"; pwd`
+
+
+# Sets the default values for elasticsearch variables used in this script
+if [ -z "$CONF_DIR" ]; then
+ CONF_DIR="$ES_HOME/config"
+fi
+
+# The default env file is defined at building/packaging time.
+# For a distribution package, the value is "".
+ES_ENV_FILE=""
+
+# If an include is specified with the ES_INCLUDE environment variable, use it
+if [ -n "$ES_INCLUDE" ]; then
+ ES_ENV_FILE="$ES_INCLUDE"
+fi
+
+# Source the environment file
+if [ -n "$ES_ENV_FILE" ]; then
+
+ # If the ES_ENV_FILE is not found, try to resolve the path
+ # against the ES_HOME directory
+ if [ ! -f "$ES_ENV_FILE" ]; then
+ ES_ENV_FILE="$ELASTIC_HOME/$ES_ENV_FILE"
+ fi
+
+ . "$ES_ENV_FILE"
+ if [ $? -ne 0 ]; then
+ echo "Unable to source environment file: $ES_ENV_FILE" >&2
+ exit 1
+ fi
+fi
+
+# don't let JAVA_TOOL_OPTIONS slip in (e.g. crazy agents in ubuntu)
+# works around https://bugs.launchpad.net/ubuntu/+source/jayatana/+bug/1441487
+if [ "x$JAVA_TOOL_OPTIONS" != "x" ]; then
+ echo "Warning: Ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS"
+ unset JAVA_TOOL_OPTIONS
+fi
+
+# CONF_FILE setting was removed
+if [ ! -z "$CONF_FILE" ]; then
+ echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed."
+ exit 1
+fi
+
+if [ -x "$JAVA_HOME/bin/java" ]; then
+ JAVA=$JAVA_HOME/bin/java
+else
+ JAVA=`which java`
+fi
+
+if [ ! -x "$JAVA" ]; then
+ echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"
+ exit 1
+fi
+
+# full hostname passed through cut for portability on systems that do not support hostname -s
+# export on separate line for shells that do not support combining definition and export
+HOSTNAME=`hostname | cut -d. -f1`
+export HOSTNAME
+
+declare -a args=("$@")
+
+if [ -e "$CONF_DIR" ]; then
+ args=("${args[@]}" -Edefault.path.conf="$CONF_DIR")
+fi
+
+exec "$JAVA" $ES_JAVA_OPTS -Delasticsearch -Des.path.home="$ES_HOME" -cp "$ES_HOME/lib/*" org.elasticsearch.index.translog.TranslogToolCli "${args[@]}"
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog.bat b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog.bat
new file mode 100644
index 00000000000..90a07546ef1
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch-translog.bat
@@ -0,0 +1,61 @@
+@echo off
+
+SETLOCAL enabledelayedexpansion
+
+IF DEFINED JAVA_HOME (
+ set JAVA=%JAVA_HOME%\bin\java.exe
+) ELSE (
+ FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
+)
+IF NOT EXIST "%JAVA%" (
+ ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2
+ EXIT /B 1
+)
+
+set SCRIPT_DIR=%~dp0
+for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI
+
+TITLE Elasticsearch Plugin Manager 5.0.2
+
+SET properties=
+SET args=
+
+:loop
+SET "current=%~1"
+SHIFT
+IF "x!current!" == "x" GOTO breakloop
+
+IF "!current:~0,2%!" == "-D" (
+ ECHO "!current!" | FINDSTR /C:"=">nul && (
+ :: current matches -D*=*
+ IF "x!properties!" NEQ "x" (
+ SET properties=!properties! "!current!"
+ ) ELSE (
+ SET properties="!current!"
+ )
+ ) || (
+ :: current matches -D*
+ IF "x!properties!" NEQ "x" (
+ SET properties=!properties! "!current!=%~1"
+ ) ELSE (
+ SET properties="!current!=%~1"
+ )
+ SHIFT
+ )
+) ELSE (
+ :: current matches *
+ IF "x!args!" NEQ "x" (
+ SET args=!args! "!current!"
+ ) ELSE (
+ SET args="!current!"
+ )
+)
+
+GOTO loop
+:breakloop
+
+SET HOSTNAME=%COMPUTERNAME%
+
+"%JAVA%" %ES_JAVA_OPTS% -Des.path.home="%ES_HOME%" !properties! -cp "%ES_HOME%/lib/*;" "org.elasticsearch.index.translog.TranslogToolCli" !args!
+
+ENDLOCAL
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.bat b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.bat
new file mode 100644
index 00000000000..c3ce9c847f5
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.bat
@@ -0,0 +1,84 @@
+@echo off
+
+SETLOCAL enabledelayedexpansion
+TITLE Elasticsearch 5.0.2
+
+SET params='%*'
+
+rem TODO: remove for Elasticsearch 6.x
+set bad_env_var=0
+if not "%ES_MIN_MEM%" == "" set bad_env_var=1
+if not "%ES_MAX_MEM%" == "" set bad_env_var=1
+if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1
+if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1
+if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1
+if not "%ES_USE_IPV4%" == "" set bad_env_var=1
+if not "%ES_GC_OPTS%" == "" set bad_env_var=1
+if not "%ES_GC_LOG_FILE%" == "" set bad_env_var=1
+if %bad_env_var% == 1 (
+ echo Error: encountered environment variables that are no longer supported
+ echo Use jvm.options or ES_JAVA_OPTS to configure the JVM
+ if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM%: set -Xms%ES_MIN_MEM% in jvm.options or add "-Xms%ES_MIN_MEM%" to ES_JAVA_OPTS
+ if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM%: set -Xmx%ES_MAX_MEM% in jvm.options or add "-Xmx%ES_MAX_MEM%" to ES_JAVA_OPTS
+ if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE%: set -Xms%ES_HEAP_SIZE% and -Xmx%ES_HEAP_SIZE% in jvm.options or add "-Xms%ES_HEAP_SIZE% -Xmx%ES_HEAP_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE%: set -Xmn%ES_HEAP_NEWSIZE% in jvm.options or add "-Xmn%ES_HEAP_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE%: set -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE% in jvm.options or add "-XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%" to ES_JAVA_OPTS
+ if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4%: set -Djava.net.preferIPv4Stack=true in jvm.options or add "-Djava.net.preferIPv4Stack=true" to ES_JAVA_OPTS
+ if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS%: set %ES_GC_OPTS: = and % in jvm.options or add "%ES_GC_OPTS%" to ES_JAVA_OPTS
+ if not "%ES_GC_LOG_FILE%" == "" echo ES_GC_LOG_FILE=%ES_GC_LOG_FILE%: set -Xloggc:%ES_GC_LOG_FILE% in jvm.options or add "-Xloggc:%ES_GC_LOG_FILE%" to ES_JAVA_OPTS"
+ exit /b 1
+)
+rem end TODO: remove for Elasticsearch 6.x
+
+:loop
+FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
+ SET current=%%A
+ SET params='%%B'
+ SET silent=N
+
+ IF "!current!" == "-s" (
+ SET silent=Y
+ )
+ IF "!current!" == "--silent" (
+ SET silent=Y
+ )
+
+ IF "!silent!" == "Y" (
+ SET nopauseonerror=Y
+ ) ELSE (
+ IF "x!newparams!" NEQ "x" (
+ SET newparams=!newparams! !current!
+ ) ELSE (
+ SET newparams=!current!
+ )
+ )
+
+ IF "x!params!" NEQ "x" (
+ GOTO loop
+ )
+)
+
+SET HOSTNAME=%COMPUTERNAME%
+
+if "%ES_JVM_OPTIONS%" == "" (
+rem '0' is the batch file, '~dp' appends the drive and path
+set ES_JVM_OPTIONS=%~dp0\..\config\jvm.options
+)
+
+@setlocal
+rem extract the options from the JVM options file %ES_JVM_OPTIONS%
+rem such options are the lines beginning with '-', thus "findstr /b"
+for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM_OPTIONS=!JVM_OPTIONS! %%a
+@endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS% %ES_JAVA_OPTS%
+
+CALL "%~dp0elasticsearch.in.bat"
+IF ERRORLEVEL 1 (
+ IF NOT DEFINED nopauseonerror (
+ PAUSE
+ )
+ EXIT /B %ERRORLEVEL%
+)
+
+"%JAVA%" %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams!
+
+ENDLOCAL
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.bat b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.bat
new file mode 100644
index 00000000000..062c09b805b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.bat
@@ -0,0 +1,25 @@
+@echo off
+
+IF DEFINED JAVA_HOME (
+ set JAVA=%JAVA_HOME%\bin\java.exe
+) ELSE (
+ FOR %%I IN (java.exe) DO set JAVA=%%~$PATH:I
+)
+IF NOT EXIST "%JAVA%" (
+ ECHO Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME 1>&2
+ EXIT /B 1
+)
+
+set SCRIPT_DIR=%~dp0
+for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI
+
+REM check in case a user was using this mechanism
+if "%ES_CLASSPATH%" == "" (
+set ES_CLASSPATH=!ES_HOME!/lib/elasticsearch-5.0.2.jar;!ES_HOME!/lib/*
+) else (
+ECHO Error: Don't modify the classpath with ES_CLASSPATH, Best is to add 1>&2
+ECHO additional elements via the plugin mechanism, or if code must really be 1>&2
+ECHO added to the main classpath, add jars to lib\, unsupported 1>&2
+EXIT /B 1
+)
+set ES_PARAMS=-Delasticsearch -Des.path.home="%ES_HOME%"
diff --git a/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.sh b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.sh
new file mode 100755
index 00000000000..5a3239e389d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/bin/elasticsearch.in.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# check in case a user was using this mechanism
+if [ "x$ES_CLASSPATH" != "x" ]; then
+ cat >&2 << EOF
+Error: Don't modify the classpath with ES_CLASSPATH. Best is to add
+additional elements via the plugin mechanism, or if code must really be
+added to the main classpath, add jars to lib/ (unsupported).
+EOF
+ exit 1
+fi
+
+ES_CLASSPATH="$ES_HOME/lib/elasticsearch-5.0.2.jar:$ES_HOME/lib/*"
diff --git a/sonar-application/src/main/assembly/elasticsearch/config/elasticsearch.yml b/sonar-application/src/main/assembly/elasticsearch/config/elasticsearch.yml
new file mode 100644
index 00000000000..bca86355509
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/config/elasticsearch.yml
@@ -0,0 +1,91 @@
+# ======================== Elasticsearch Configuration =========================
+#
+# NOTE: Elasticsearch comes with reasonable defaults for most settings.
+# Before you set out to tweak and tune the configuration, make sure you
+# understand what are you trying to accomplish and the consequences.
+#
+# The primary way of configuring a node is via this file. This template lists
+# the most important settings you may want to configure for a production cluster.
+#
+# Please see the documentation for further information on configuration options:
+# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/settings.html>
+#
+# ---------------------------------- Cluster -----------------------------------
+#
+# Use a descriptive name for your cluster:
+#
+#cluster.name: my-application
+#
+# ------------------------------------ Node ------------------------------------
+#
+# Use a descriptive name for the node:
+#
+#node.name: node-1
+#
+# Add custom attributes to the node:
+#
+#node.attr.rack: r1
+#
+# ----------------------------------- Paths ------------------------------------
+#
+# Path to directory where to store the data (separate multiple locations by comma):
+#
+#path.data: /path/to/data
+#
+# Path to log files:
+#
+#path.logs: /path/to/logs
+#
+# ----------------------------------- Memory -----------------------------------
+#
+# Lock the memory on startup:
+#
+#bootstrap.memory_lock: true
+#
+# Make sure that the heap size is set to about half the memory available
+# on the system and that the owner of the process is allowed to use this
+# limit.
+#
+# Elasticsearch performs poorly when the system is swapping the memory.
+#
+# ---------------------------------- Network -----------------------------------
+#
+# Set the bind address to a specific IP (IPv4 or IPv6):
+#
+#network.host: 192.168.0.1
+#
+# Set a custom port for HTTP:
+#
+#http.port: 9200
+#
+# For more information, see the documentation at:
+# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-network.html>
+#
+# --------------------------------- Discovery ----------------------------------
+#
+# Pass an initial list of hosts to perform discovery when new node is started:
+# The default list of hosts is ["127.0.0.1", "[::1]"]
+#
+#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
+#
+# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
+#
+#discovery.zen.minimum_master_nodes: 3
+#
+# For more information, see the documentation at:
+# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-discovery-zen.html>
+#
+# ---------------------------------- Gateway -----------------------------------
+#
+# Block initial recovery after a full cluster restart until N nodes are started:
+#
+#gateway.recover_after_nodes: 3
+#
+# For more information, see the documentation at:
+# <https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-gateway.html>
+#
+# ---------------------------------- Various -----------------------------------
+#
+# Require explicit names when deleting indices:
+#
+#action.destructive_requires_name: true
diff --git a/sonar-application/src/main/assembly/elasticsearch/config/jvm.options b/sonar-application/src/main/assembly/elasticsearch/config/jvm.options
new file mode 100644
index 00000000000..be2b6ab73a2
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/config/jvm.options
@@ -0,0 +1,103 @@
+## JVM configuration
+
+################################################################
+## IMPORTANT: JVM heap size
+################################################################
+##
+## You should always set the min and max JVM heap
+## size to the same value. For example, to set
+## the heap to 4 GB, set:
+##
+## -Xms4g
+## -Xmx4g
+##
+## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
+## for more information
+##
+################################################################
+
+# Xms represents the initial size of total heap space
+# Xmx represents the maximum size of total heap space
+
+-Xms2g
+-Xmx2g
+
+################################################################
+## Expert settings
+################################################################
+##
+## All settings below this section are considered
+## expert settings. Don't tamper with them unless
+## you understand what you are doing
+##
+################################################################
+
+## GC configuration
+-XX:+UseConcMarkSweepGC
+-XX:CMSInitiatingOccupancyFraction=75
+-XX:+UseCMSInitiatingOccupancyOnly
+
+## optimizations
+
+# disable calls to System#gc
+-XX:+DisableExplicitGC
+
+# pre-touch memory pages used by the JVM during initialization
+-XX:+AlwaysPreTouch
+
+## basic
+
+# force the server VM
+-server
+
+# set to headless, just in case
+-Djava.awt.headless=true
+
+# ensure UTF-8 encoding by default (e.g. filenames)
+-Dfile.encoding=UTF-8
+
+# use our provided JNA always versus the system one
+-Djna.nosys=true
+
+# use old-style file permissions on JDK9
+-Djdk.io.permissionsUseCanonicalPath=true
+
+# flags to keep Netty from being unsafe
+-Dio.netty.noUnsafe=true
+-Dio.netty.noKeySetOptimization=true
+
+# log4j 2
+-Dlog4j.shutdownHookEnabled=false
+-Dlog4j2.disable.jmx=true
+-Dlog4j.skipJansi=true
+
+## heap dumps
+
+# generate a heap dump when an allocation from the Java heap fails
+# heap dumps are created in the working directory of the JVM
+-XX:+HeapDumpOnOutOfMemoryError
+
+# specify an alternative path for heap dumps
+# ensure the directory exists and has sufficient space
+#-XX:HeapDumpPath=${heap.dump.path}
+
+## GC logging
+
+#-XX:+PrintGCDetails
+#-XX:+PrintGCTimeStamps
+#-XX:+PrintGCDateStamps
+#-XX:+PrintClassHistogram
+#-XX:+PrintTenuringDistribution
+#-XX:+PrintGCApplicationStoppedTime
+
+# log GC status to a file with time stamps
+# ensure the directory exists
+#-Xloggc:${loggc}
+
+# Elasticsearch 5.0.0 will throw an exception on unquoted field names in JSON.
+# If documents were already indexed with unquoted fields in a previous version
+# of Elasticsearch, some operations may throw errors.
+#
+# WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided
+# only for migration purposes.
+#-Delasticsearch.json.allow_unquoted_field_names=true
diff --git a/sonar-application/src/main/assembly/elasticsearch/config/log4j2.properties b/sonar-application/src/main/assembly/elasticsearch/config/log4j2.properties
new file mode 100644
index 00000000000..3702afff9f3
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/config/log4j2.properties
@@ -0,0 +1,74 @@
+status = error
+
+# log action execution errors for easier debugging
+logger.action.name = org.elasticsearch.action
+logger.action.level = debug
+
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
+
+appender.rolling.type = RollingFile
+appender.rolling.name = rolling
+appender.rolling.fileName = ${sys:es.logs}.log
+appender.rolling.layout.type = PatternLayout
+appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
+appender.rolling.filePattern = ${sys:es.logs}-%d{yyyy-MM-dd}.log
+appender.rolling.policies.type = Policies
+appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
+appender.rolling.policies.time.interval = 1
+appender.rolling.policies.time.modulate = true
+
+rootLogger.level = info
+rootLogger.appenderRef.console.ref = console
+rootLogger.appenderRef.rolling.ref = rolling
+
+appender.deprecation_rolling.type = RollingFile
+appender.deprecation_rolling.name = deprecation_rolling
+appender.deprecation_rolling.fileName = ${sys:es.logs}_deprecation.log
+appender.deprecation_rolling.layout.type = PatternLayout
+appender.deprecation_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%.-10000m%n
+appender.deprecation_rolling.filePattern = ${sys:es.logs}_deprecation-%i.log.gz
+appender.deprecation_rolling.policies.type = Policies
+appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
+appender.deprecation_rolling.policies.size.size = 1GB
+appender.deprecation_rolling.strategy.type = DefaultRolloverStrategy
+appender.deprecation_rolling.strategy.max = 4
+
+logger.deprecation.name = org.elasticsearch.deprecation
+logger.deprecation.level = warn
+logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
+logger.deprecation.additivity = false
+
+appender.index_search_slowlog_rolling.type = RollingFile
+appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
+appender.index_search_slowlog_rolling.fileName = ${sys:es.logs}_index_search_slowlog.log
+appender.index_search_slowlog_rolling.layout.type = PatternLayout
+appender.index_search_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
+appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs}_index_search_slowlog-%d{yyyy-MM-dd}.log
+appender.index_search_slowlog_rolling.policies.type = Policies
+appender.index_search_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
+appender.index_search_slowlog_rolling.policies.time.interval = 1
+appender.index_search_slowlog_rolling.policies.time.modulate = true
+
+logger.index_search_slowlog_rolling.name = index.search.slowlog
+logger.index_search_slowlog_rolling.level = trace
+logger.index_search_slowlog_rolling.appenderRef.index_search_slowlog_rolling.ref = index_search_slowlog_rolling
+logger.index_search_slowlog_rolling.additivity = false
+
+appender.index_indexing_slowlog_rolling.type = RollingFile
+appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
+appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs}_index_indexing_slowlog.log
+appender.index_indexing_slowlog_rolling.layout.type = PatternLayout
+appender.index_indexing_slowlog_rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%.-10000m%n
+appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs}_index_indexing_slowlog-%d{yyyy-MM-dd}.log
+appender.index_indexing_slowlog_rolling.policies.type = Policies
+appender.index_indexing_slowlog_rolling.policies.time.type = TimeBasedTriggeringPolicy
+appender.index_indexing_slowlog_rolling.policies.time.interval = 1
+appender.index_indexing_slowlog_rolling.policies.time.modulate = true
+
+logger.index_indexing_slowlog.name = index.indexing.slowlog.index
+logger.index_indexing_slowlog.level = trace
+logger.index_indexing_slowlog.appenderRef.index_indexing_slowlog_rolling.ref = index_indexing_slowlog_rolling
+logger.index_indexing_slowlog.additivity = false
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/HdrHistogram-2.1.6.jar b/sonar-application/src/main/assembly/elasticsearch/lib/HdrHistogram-2.1.6.jar
new file mode 100644
index 00000000000..04eb3807b74
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/HdrHistogram-2.1.6.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/elasticsearch-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/elasticsearch-5.0.2.jar
new file mode 100644
index 00000000000..2d345a0ce3e
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/elasticsearch-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/hppc-0.7.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/hppc-0.7.1.jar
new file mode 100644
index 00000000000..ed318de2148
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/hppc-0.7.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jackson-core-2.8.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-core-2.8.1.jar
new file mode 100644
index 00000000000..29230d46bdc
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-core-2.8.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-cbor-2.8.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-cbor-2.8.1.jar
new file mode 100644
index 00000000000..b69dca640f8
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-cbor-2.8.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-smile-2.8.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-smile-2.8.1.jar
new file mode 100644
index 00000000000..9096d95d674
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-smile-2.8.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-yaml-2.8.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-yaml-2.8.1.jar
new file mode 100644
index 00000000000..01c0bceb499
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jackson-dataformat-yaml-2.8.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jna-4.2.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jna-4.2.2.jar
new file mode 100644
index 00000000000..a943670981d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jna-4.2.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/joda-time-2.9.5.jar b/sonar-application/src/main/assembly/elasticsearch/lib/joda-time-2.9.5.jar
new file mode 100644
index 00000000000..2567cbd037f
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/joda-time-2.9.5.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jopt-simple-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jopt-simple-5.0.2.jar
new file mode 100644
index 00000000000..2c7a0872d2f
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jopt-simple-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/jts-1.13.jar b/sonar-application/src/main/assembly/elasticsearch/lib/jts-1.13.jar
new file mode 100644
index 00000000000..bbaa20bfacd
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/jts-1.13.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/log4j-1.2-api-2.6.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-1.2-api-2.6.2.jar
new file mode 100644
index 00000000000..0615df7af0a
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-1.2-api-2.6.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/log4j-api-2.6.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-api-2.6.2.jar
new file mode 100644
index 00000000000..a40cc563e97
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-api-2.6.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/log4j-core-2.6.2.jar b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-core-2.6.2.jar
new file mode 100644
index 00000000000..388918f6c79
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/log4j-core-2.6.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-analyzers-common-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-analyzers-common-6.2.1.jar
new file mode 100644
index 00000000000..52df2a773f3
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-analyzers-common-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-backward-codecs-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-backward-codecs-6.2.1.jar
new file mode 100644
index 00000000000..30cf3b95764
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-backward-codecs-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-core-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-core-6.2.1.jar
new file mode 100644
index 00000000000..e557e1b955b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-core-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-grouping-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-grouping-6.2.1.jar
new file mode 100644
index 00000000000..551492d68ed
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-grouping-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-highlighter-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-highlighter-6.2.1.jar
new file mode 100644
index 00000000000..b9d80415263
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-highlighter-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-join-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-join-6.2.1.jar
new file mode 100644
index 00000000000..d5843951b50
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-join-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-memory-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-memory-6.2.1.jar
new file mode 100644
index 00000000000..0113165c497
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-memory-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-misc-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-misc-6.2.1.jar
new file mode 100644
index 00000000000..845cf8bf740
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-misc-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queries-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queries-6.2.1.jar
new file mode 100644
index 00000000000..be78764d585
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queries-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queryparser-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queryparser-6.2.1.jar
new file mode 100644
index 00000000000..961c5090e7d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-queryparser-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-sandbox-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-sandbox-6.2.1.jar
new file mode 100644
index 00000000000..4448ca15343
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-sandbox-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-6.2.1.jar
new file mode 100644
index 00000000000..f8ae65b4756
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-extras-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-extras-6.2.1.jar
new file mode 100644
index 00000000000..f6f12dc02b9
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial-extras-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial3d-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial3d-6.2.1.jar
new file mode 100644
index 00000000000..d8da9db9089
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-spatial3d-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/lucene-suggest-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-suggest-6.2.1.jar
new file mode 100644
index 00000000000..a49c732e25b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/lucene-suggest-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/securesm-1.1.jar b/sonar-application/src/main/assembly/elasticsearch/lib/securesm-1.1.jar
new file mode 100644
index 00000000000..3e38947880b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/securesm-1.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/snakeyaml-1.15.jar b/sonar-application/src/main/assembly/elasticsearch/lib/snakeyaml-1.15.jar
new file mode 100644
index 00000000000..34084e33257
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/snakeyaml-1.15.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/spatial4j-0.6.jar b/sonar-application/src/main/assembly/elasticsearch/lib/spatial4j-0.6.jar
new file mode 100644
index 00000000000..1afa5074b03
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/spatial4j-0.6.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/lib/t-digest-3.0.jar b/sonar-application/src/main/assembly/elasticsearch/lib/t-digest-3.0.jar
new file mode 100644
index 00000000000..cfb29bcccd6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/lib/t-digest-3.0.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.0.2.jar
new file mode 100644
index 00000000000..15e282b6226
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/aggs-matrix-stats-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/plugin-descriptor.properties
new file mode 100644
index 00000000000..9d14ee253ce
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/aggs-matrix-stats/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Adds aggregations whose input are a list of numeric fields and output includes a matrix.
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=aggs-matrix-stats
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.search.aggregations.matrix.MatrixAggregationPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/ingest-common-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/ingest-common-5.0.2.jar
new file mode 100644
index 00000000000..7a8d3ceb184
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/ingest-common-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/jcodings-1.0.12.jar b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/jcodings-1.0.12.jar
new file mode 100644
index 00000000000..5493b50b4c8
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/jcodings-1.0.12.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/joni-2.1.6.jar b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/joni-2.1.6.jar
new file mode 100644
index 00000000000..7ec4d1507f0
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/joni-2.1.6.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/plugin-descriptor.properties
new file mode 100644
index 00000000000..b634de8bc40
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/ingest-common/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Module for ingest processors that do not require additional security permissions or have large dependencies and resources
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=ingest-common
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.ingest.common.IngestCommonPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jar
new file mode 100644
index 00000000000..387129d648f
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/antlr4-runtime-4.5.1-1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-5.0.4.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-5.0.4.jar
new file mode 100644
index 00000000000..cdb283dd7f6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-5.0.4.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-commons-5.0.4.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-commons-5.0.4.jar
new file mode 100644
index 00000000000..e89265f1e6c
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-commons-5.0.4.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-tree-5.0.4.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-tree-5.0.4.jar
new file mode 100644
index 00000000000..ac68a32ec19
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/asm-tree-5.0.4.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lang-expression-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lang-expression-5.0.2.jar
new file mode 100644
index 00000000000..722a2584035
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lang-expression-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lucene-expressions-6.2.1.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lucene-expressions-6.2.1.jar
new file mode 100644
index 00000000000..33ffc2dc712
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/lucene-expressions-6.2.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-descriptor.properties
new file mode 100644
index 00000000000..354818fb7e7
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Lucene expressions integration for Elasticsearch
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=lang-expression
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.script.expression.ExpressionPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-security.policy
new file mode 100644
index 00000000000..c11af51e464
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-expression/plugin-security.policy
@@ -0,0 +1,32 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant {
+ // needed to generate runtime classes
+ permission java.lang.RuntimePermission "createClassLoader";
+
+ // expression runtime
+ permission org.elasticsearch.script.ClassPermission "java.lang.String";
+ permission org.elasticsearch.script.ClassPermission "org.apache.lucene.expressions.Expression";
+ permission org.elasticsearch.script.ClassPermission "org.apache.lucene.queries.function.FunctionValues";
+ // available functions
+ permission org.elasticsearch.script.ClassPermission "java.lang.Math";
+ permission org.elasticsearch.script.ClassPermission "org.apache.lucene.util.MathUtil";
+ permission org.elasticsearch.script.ClassPermission "org.apache.lucene.util.SloppyMath";
+};
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jar
new file mode 100644
index 00000000000..ce3531e0bf3
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/groovy-2.4.6-indy.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/lang-groovy-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/lang-groovy-5.0.2.jar
new file mode 100644
index 00000000000..f1009e8ccf6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/lang-groovy-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-descriptor.properties
new file mode 100644
index 00000000000..7360511445a
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Groovy scripting integration for Elasticsearch
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=lang-groovy
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.script.groovy.GroovyPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-security.policy
new file mode 100644
index 00000000000..13d00d6d17c
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-groovy/plugin-security.policy
@@ -0,0 +1,59 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant {
+ // needed to generate runtime classes
+ permission java.lang.RuntimePermission "createClassLoader";
+ // needed by IndyInterface
+ permission java.lang.RuntimePermission "getClassLoader";
+ // needed by groovy engine
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ permission java.lang.RuntimePermission "accessClassInPackage.sun.reflect";
+ permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect";
+ // Allow executing groovy scripts with codesource of /untrusted
+ permission groovy.security.GroovyCodeSourcePermission "/untrusted";
+
+ // Standard set of classes
+ permission org.elasticsearch.script.ClassPermission "<<STANDARD>>";
+ // groovy runtime (TODO: clean these up if possible)
+ permission org.elasticsearch.script.ClassPermission "groovy.grape.GrabAnnotationTransformation";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.Binding";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.GroovyObject";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.GString";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.Script";
+ permission org.elasticsearch.script.ClassPermission "groovy.util.GroovyCollections";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.ast.builder.AstBuilderTransformation";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.reflection.ClassInfo";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.GStringImpl";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.powerassert.ValueRecorder";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.powerassert.AssertionRenderer";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.ScriptBytecodeAdapter";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.vmplugin.v7.IndyInterface";
+ permission org.elasticsearch.script.ClassPermission "sun.reflect.ConstructorAccessorImpl";
+ permission org.elasticsearch.script.ClassPermission "sun.reflect.MethodAccessorImpl";
+ permission org.elasticsearch.script.ClassPermission "jdk.internal.reflect.ConstructorAccessorImpl";
+ permission org.elasticsearch.script.ClassPermission "jdk.internal.reflect.MethodAccessorImpl";
+
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.Closure";
+ permission org.elasticsearch.script.ClassPermission "org.codehaus.groovy.runtime.GeneratedClosure";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.MetaClass";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.Range";
+ permission org.elasticsearch.script.ClassPermission "groovy.lang.Reference";
+};
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/compiler-0.9.3.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/compiler-0.9.3.jar
new file mode 100644
index 00000000000..60cae63f4b1
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/compiler-0.9.3.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/lang-mustache-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/lang-mustache-5.0.2.jar
new file mode 100644
index 00000000000..e55808976c8
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/lang-mustache-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-descriptor.properties
new file mode 100644
index 00000000000..ddb10bd2c47
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Mustache scripting integration for Elasticsearch
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=lang-mustache
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.script.mustache.MustachePlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-security.policy
new file mode 100644
index 00000000000..ea2db551912
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-mustache/plugin-security.policy
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant {
+ // needed to do crazy reflection
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+};
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jar
new file mode 100644
index 00000000000..387129d648f
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/antlr4-runtime-4.5.1-1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/asm-debug-all-5.1.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/asm-debug-all-5.1.jar
new file mode 100644
index 00000000000..34b7bfada69
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/asm-debug-all-5.1.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/lang-painless-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/lang-painless-5.0.2.jar
new file mode 100644
index 00000000000..82c75b0a579
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/lang-painless-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-descriptor.properties
new file mode 100644
index 00000000000..528e4091f6b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=An easy, safe and fast scripting language for Elasticsearch
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=lang-painless
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.painless.PainlessPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-security.policy
new file mode 100644
index 00000000000..e45c1b86ceb
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/lang-painless/plugin-security.policy
@@ -0,0 +1,23 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant {
+ // needed to generate runtime classes
+ permission java.lang.RuntimePermission "createClassLoader";
+};
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/percolator/percolator-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/percolator/percolator-5.0.2.jar
new file mode 100644
index 00000000000..5333ccba4b1
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/percolator/percolator-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/percolator/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/percolator/plugin-descriptor.properties
new file mode 100644
index 00000000000..d09cad0a7de
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/percolator/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Percolator module adds capability to index queries and query these queries by specifying documents
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=percolator
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.percolator.PercolatorPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-codec-1.10.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-codec-1.10.jar
new file mode 100644
index 00000000000..1d7417c4031
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-codec-1.10.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-logging-1.1.3.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-logging-1.1.3.jar
new file mode 100644
index 00000000000..ab5125407a6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/commons-logging-1.1.3.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpasyncclient-4.1.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpasyncclient-4.1.2.jar
new file mode 100644
index 00000000000..20a8a5a785d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpasyncclient-4.1.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpclient-4.5.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpclient-4.5.2.jar
new file mode 100644
index 00000000000..701609fcc84
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpclient-4.5.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-4.4.5.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-4.4.5.jar
new file mode 100644
index 00000000000..6bbf0ac8b73
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-4.4.5.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-nio-4.4.5.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-nio-4.4.5.jar
new file mode 100644
index 00000000000..18452862c74
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/httpcore-nio-4.4.5.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/plugin-descriptor.properties
new file mode 100644
index 00000000000..25e7c9e248d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=The Reindex module adds APIs to reindex from one index to another or update documents in place.
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=reindex
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.index.reindex.ReindexPlugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/reindex-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/reindex-5.0.2.jar
new file mode 100644
index 00000000000..8719236ac8d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/reindex-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/reindex/rest-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/rest-5.0.2.jar
new file mode 100644
index 00000000000..71690e1189b
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/reindex/rest-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jar
new file mode 100644
index 00000000000..b0a1bdad610
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/netty-3.10.6.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-descriptor.properties
new file mode 100644
index 00000000000..ae8baa4d287
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Netty 3 based transport implementation
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=transport-netty3
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.transport.Netty3Plugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-security.policy
new file mode 100644
index 00000000000..45c8cd923aa
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/plugin-security.policy
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant {
+ // Netty SelectorUtil wants to change this, because of https://bugs.openjdk.java.net/browse/JDK-6427854
+ // the bug says it only happened rarely, and that its fixed, but apparently it still happens rarely!
+ permission java.util.PropertyPermission "sun.nio.ch.bugLevel", "write";
+}; \ No newline at end of file
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/transport-netty3-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/transport-netty3-5.0.2.jar
new file mode 100644
index 00000000000..cd74441d9b9
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty3/transport-netty3-5.0.2.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-buffer-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-buffer-4.1.5.Final.jar
new file mode 100644
index 00000000000..0631d79a4c6
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-buffer-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-4.1.5.Final.jar
new file mode 100644
index 00000000000..8796fea9e3d
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-http-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-http-4.1.5.Final.jar
new file mode 100644
index 00000000000..98a9b88697a
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-codec-http-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-common-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-common-4.1.5.Final.jar
new file mode 100644
index 00000000000..85a5b03d955
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-common-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-handler-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-handler-4.1.5.Final.jar
new file mode 100644
index 00000000000..85760a6e703
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-handler-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-resolver-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-resolver-4.1.5.Final.jar
new file mode 100644
index 00000000000..6eeb6208330
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-resolver-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-transport-4.1.5.Final.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-transport-4.1.5.Final.jar
new file mode 100644
index 00000000000..a76785a10cf
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/netty-transport-4.1.5.Final.jar
Binary files differ
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-descriptor.properties b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-descriptor.properties
new file mode 100644
index 00000000000..e3d1ee16cd4
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-descriptor.properties
@@ -0,0 +1,40 @@
+# Elasticsearch plugin descriptor file
+# This file must exist as 'plugin-descriptor.properties' in a folder named `elasticsearch`
+# inside all plugins.
+#
+### example plugin for "foo"
+#
+# foo.zip <-- zip file for the plugin, with this structure:
+#|____elasticsearch/
+#| |____ <arbitrary name1>.jar <-- classes, resources, dependencies
+#| |____ <arbitrary nameN>.jar <-- any number of jars
+#| |____ plugin-descriptor.properties <-- example contents below:
+#
+# classname=foo.bar.BazPlugin
+# description=My cool plugin
+# version=2.0
+# elasticsearch.version=2.0
+# java.version=1.7
+#
+### mandatory elements for all plugins:
+#
+# 'description': simple summary of the plugin
+description=Netty 4 based transport implementation
+#
+# 'version': plugin's version
+version=5.0.2
+#
+# 'name': the plugin name
+name=transport-netty4
+#
+# 'classname': the name of the class to load, fully-qualified.
+classname=org.elasticsearch.transport.Netty4Plugin
+#
+# 'java.version' version of java the code is built against
+# use the system property java.specification.version
+# version string must be a sequence of nonnegative decimal integers
+# separated by "."'s and may have leading zeros
+java.version=1.8
+#
+# 'elasticsearch.version' version of elasticsearch compiled against
+elasticsearch.version=5.0.2
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-security.policy b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-security.policy
new file mode 100644
index 00000000000..a8cd1a7fffd
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/plugin-security.policy
@@ -0,0 +1,24 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch 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.
+ */
+
+grant codeBase "${codebase.netty-transport-4.1.5.Final.jar}" {
+ // Netty NioEventLoop wants to change this, because of https://bugs.openjdk.java.net/browse/JDK-6427854
+ // the bug says it only happened rarely, and that its fixed, but apparently it still happens rarely!
+ permission java.util.PropertyPermission "sun.nio.ch.bugLevel", "write";
+}; \ No newline at end of file
diff --git a/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/transport-netty4-5.0.2.jar b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/transport-netty4-5.0.2.jar
new file mode 100644
index 00000000000..9b211186024
--- /dev/null
+++ b/sonar-application/src/main/assembly/elasticsearch/modules/transport-netty4/transport-netty4-5.0.2.jar
Binary files differ