use of org.sonar.server.es.newindex.NewRegularIndex in project sonarqube by SonarSource.
the class RuleIndexDefinition method define.
@Override
public void define(IndexDefinitionContext context) {
NewRegularIndex index = context.create(DESCRIPTOR, newBuilder(config).setRefreshInterval(MANUAL_REFRESH_INTERVAL).setDefaultNbOfShards(2).build()).setEnableSource(enableSource);
// Rule type
TypeMapping ruleMapping = index.createTypeMapping(TYPE_RULE);
ruleMapping.keywordFieldBuilder(FIELD_RULE_UUID).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_KEY).addSubFields(SORTABLE_ANALYZER).build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_RULE_KEY).addSubFields(SORTABLE_ANALYZER).build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_REPOSITORY).build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_INTERNAL_KEY).disableNorms().disableSearch().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_NAME).addSubFields(SORTABLE_ANALYZER, SEARCH_GRAMS_ANALYZER).build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_HTML_DESCRIPTION).disableSearch().disableNorms().disableSortingAndAggregating().addSubFields(ENGLISH_HTML_ANALYZER).build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_SEVERITY).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_STATUS).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_LANGUAGE).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_TAGS).build();
ruleMapping.createBooleanField(FIELD_RULE_IS_TEMPLATE);
ruleMapping.createBooleanField(FIELD_RULE_IS_EXTERNAL);
ruleMapping.keywordFieldBuilder(FIELD_RULE_TEMPLATE_KEY).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_TYPE).disableNorms().build();
ruleMapping.createLongField(FIELD_RULE_CREATED_AT);
ruleMapping.createLongField(FIELD_RULE_UPDATED_AT);
ruleMapping.keywordFieldBuilder(FIELD_RULE_CWE).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_OWASP_TOP_10).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_SANS_TOP_25).disableNorms().build();
ruleMapping.keywordFieldBuilder(FIELD_RULE_SONARSOURCE_SECURITY).disableNorms().build();
// Active rule
index.createTypeMapping(TYPE_ACTIVE_RULE).keywordFieldBuilder(FIELD_ACTIVE_RULE_UUID).disableNorms().build().keywordFieldBuilder(FIELD_ACTIVE_RULE_PROFILE_UUID).disableNorms().build().keywordFieldBuilder(FIELD_ACTIVE_RULE_INHERITANCE).disableNorms().build().keywordFieldBuilder(FIELD_ACTIVE_RULE_SEVERITY).disableNorms().build();
}
use of org.sonar.server.es.newindex.NewRegularIndex in project sonarqube by SonarSource.
the class UserIndexDefinition method define.
@Override
public void define(IndexDefinitionContext context) {
NewRegularIndex index = context.create(DESCRIPTOR, newBuilder(config).setDefaultNbOfShards(1).build()).setEnableSource(true);
TypeMapping mapping = index.createTypeMapping(TYPE_USER);
mapping.keywordFieldBuilder(FIELD_UUID).disableNorms().build();
mapping.keywordFieldBuilder(FIELD_LOGIN).addSubFields(USER_SEARCH_GRAMS_ANALYZER).build();
mapping.keywordFieldBuilder(FIELD_NAME).addSubFields(USER_SEARCH_GRAMS_ANALYZER).build();
mapping.keywordFieldBuilder(FIELD_EMAIL).addSubFields(USER_SEARCH_GRAMS_ANALYZER, SORTABLE_ANALYZER).build();
mapping.createBooleanField(FIELD_ACTIVE);
mapping.keywordFieldBuilder(FIELD_SCM_ACCOUNTS).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
}
use of org.sonar.server.es.newindex.NewRegularIndex in project sonarqube by SonarSource.
the class ViewIndexDefinition method define.
@Override
public void define(IndexDefinitionContext context) {
NewRegularIndex index = context.create(DESCRIPTOR, newBuilder(config).setDefaultNbOfShards(5).build()).setEnableSource(true);
// type "view"
TypeMapping mapping = index.createTypeMapping(TYPE_VIEW);
mapping.keywordFieldBuilder(FIELD_UUID).disableNorms().build();
mapping.keywordFieldBuilder(FIELD_PROJECTS).disableNorms().build();
}
use of org.sonar.server.es.newindex.NewRegularIndex in project sonarqube by SonarSource.
the class MetadataIndexDefinition method define.
public void define(IndexDefinitionContext context) {
NewRegularIndex index = context.create(DESCRIPTOR, newBuilder(configuration).setRefreshInterval(MANUAL_REFRESH_INTERVAL).setDefaultNbOfShards(DEFAULT_NUMBER_OF_SHARDS).build());
index.createTypeMapping(TYPE_METADATA).keywordFieldBuilder(FIELD_VALUE).disableSearch().store().build();
}
Aggregations