Search in sources :

Example 1 with NewRegularIndex

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();
}
Also used : NewRegularIndex(org.sonar.server.es.newindex.NewRegularIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Example 2 with NewRegularIndex

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();
}
Also used : NewRegularIndex(org.sonar.server.es.newindex.NewRegularIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Example 3 with NewRegularIndex

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();
}
Also used : NewRegularIndex(org.sonar.server.es.newindex.NewRegularIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Example 4 with NewRegularIndex

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();
}
Also used : NewRegularIndex(org.sonar.server.es.newindex.NewRegularIndex)

Aggregations

NewRegularIndex (org.sonar.server.es.newindex.NewRegularIndex)4 TypeMapping (org.sonar.server.es.newindex.TypeMapping)3