aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-core/src/main/java/org/sonar/core/rule/RuleConstants.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java5
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java56
-rw-r--r--sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java2
-rw-r--r--sonar-server/src/main/resources/org/sonar/server/es/config/elasticsearch.json2
5 files changed, 37 insertions, 32 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/rule/RuleConstants.java b/sonar-core/src/main/java/org/sonar/core/rule/RuleConstants.java
index 636a6dcd67c..a732f7bb990 100644
--- a/sonar-core/src/main/java/org/sonar/core/rule/RuleConstants.java
+++ b/sonar-core/src/main/java/org/sonar/core/rule/RuleConstants.java
@@ -21,6 +21,6 @@ package org.sonar.core.rule;
public interface RuleConstants {
- public static final String INDEX_NAME = "rules";
- public static final String ES_TYPE = "rule";
+ public static final String INDEX_NAME = "rules2";
+ public static final String ES_TYPE = "rule2";
}
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index e22bb3e9ec7..68cabc0e676 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -261,7 +261,6 @@ class ServerComponents {
components.addAll(CorePropertyDefinitions.all());
components.addAll(DatabaseMigrations.CLASSES);
components.addAll(DaoUtils.getDaoClasses());
- components.addAll(IndexUtils.getIndexClasses());
return components;
}
@@ -301,7 +300,7 @@ class ServerComponents {
* when its schema is up-to-date.
*/
Collection level3Components() {
- return Lists.newArrayList(
+ List components = Lists.newArrayList(
PersistentSettings.class,
DefaultDatabaseConnector.class,
ThreadLocalDatabaseSessionFactory.class,
@@ -312,6 +311,8 @@ class ServerComponents {
UriReader.class,
ServerIdGenerator.class
);
+ components.addAll(IndexUtils.getIndexClasses());
+ return components;
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java
index 53e53f61926..c4cc7b457f5 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java
@@ -97,32 +97,36 @@ public class RuleIndex extends BaseIndex<RuleKey> {
protected XContentBuilder getMapping() {
try {
return jsonBuilder().startObject()
- .startObject("issue")
- .startObject("properties")
- .startObject("component.path")
- .field("type", "string")
- .field("index_analyzer", "path_analyzer")
- .field("search_analyzer", "keyword")
- .endObject()
- .startObject("rule.name")
- .field("type", "string")
- .field("analyzer", "keyword")
- .endObject()
- .startObject("root.id")
- .field("type", "multi_field")
- .startObject("fields")
- .startObject("str")
- .field("type", "string")
- .field("index","analyzed")
- .field("analyzer", "default")
- .endObject()
- .startObject("num")
- .field("type", "long")
- .field("index","analyzed")
- .endObject()
- .endObject()
- .endObject()
- .endObject().endObject();
+ .startObject(this.getType()).endObject()
+ .endObject();
+
+// return jsonBuilder().startObject()
+// .startObject("issue")
+// .startObject("properties")
+// .startObject("component.path")
+// .field("type", "string")
+// .field("index_analyzer", "path_analyzer")
+// .field("search_analyzer", "keyword")
+// .endObject()
+// .startObject("rule.name")
+// .field("type", "string")
+// .field("analyzer", "keyword")
+// .endObject()
+// .startObject("root.id")
+// .field("type", "multi_field")
+// .startObject("fields")
+// .startObject("str")
+// .field("type", "string")
+// .field("index","analyzed")
+// .field("analyzer", "default")
+// .endObject()
+// .startObject("num")
+// .field("type", "long")
+// .field("index","analyzed")
+// .endObject()
+// .endObject()
+// .endObject()
+// .endObject().endObject();
} catch (IOException e) {
LOG.error("Could not create mapping for {}",this.getIndexName());
return null;
diff --git a/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java b/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
index a4a86ca34ce..666677b8207 100644
--- a/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
+++ b/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
@@ -48,7 +48,7 @@ public abstract class BaseIndex<K extends Serializable> implements Index<K> {
private static final String PROFILE_DOMAIN = "es";
private static final Logger LOG = LoggerFactory.getLogger(BaseIndex.class);
- public static final String ES_CLUSTER_NAME = "sonarcluster";
+ public static final String ES_CLUSTER_NAME = "sonarqube";
private static final String LOCAL_ES_NODE_HOST = "localhost";
private static final int LOCAL_ES_NODE_PORT = 9300;
diff --git a/sonar-server/src/main/resources/org/sonar/server/es/config/elasticsearch.json b/sonar-server/src/main/resources/org/sonar/server/es/config/elasticsearch.json
index 64913338ee0..0e9c2e651c0 100644
--- a/sonar-server/src/main/resources/org/sonar/server/es/config/elasticsearch.json
+++ b/sonar-server/src/main/resources/org/sonar/server/es/config/elasticsearch.json
@@ -4,7 +4,7 @@
},
"node": {
"name": "sonarqube",
- "local": true,
+ "local": false,
"data": true
},
"discovery": {