Search in sources :

Example 1 with NewAuthorizedIndex

use of org.sonar.server.es.newindex.NewAuthorizedIndex in project sonarqube by SonarSource.

the class FooIndexDefinition method define.

@Override
public void define(IndexDefinitionContext context) {
    NewAuthorizedIndex newIndex = context.createWithAuthorization(DESCRIPTOR, newBuilder(new MapSettings().asConfig()).setRefreshInterval(MANUAL_REFRESH_INTERVAL).build());
    newIndex.createTypeMapping(TYPE_FOO).keywordFieldBuilder(FIELD_NAME).build().keywordFieldBuilder(FIELD_PROJECT_UUID).build();
}
Also used : NewAuthorizedIndex(org.sonar.server.es.newindex.NewAuthorizedIndex) MapSettings(org.sonar.api.config.internal.MapSettings)

Example 2 with NewAuthorizedIndex

use of org.sonar.server.es.newindex.NewAuthorizedIndex in project sonarqube by SonarSource.

the class IssueIndexDefinition method define.

@Override
public void define(IndexDefinitionContext context) {
    NewAuthorizedIndex index = context.createWithAuthorization(DESCRIPTOR, newBuilder(config).setRefreshInterval(MANUAL_REFRESH_INTERVAL).setDefaultNbOfShards(5).build()).setEnableSource(enableSource);
    TypeMapping mapping = index.createTypeMapping(TYPE_ISSUE);
    mapping.keywordFieldBuilder(FIELD_ISSUE_ASSIGNEE_UUID).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_AUTHOR_LOGIN).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_COMPONENT_UUID).disableNorms().build();
    mapping.createLongField(FIELD_ISSUE_EFFORT);
    mapping.keywordFieldBuilder(FIELD_ISSUE_FILE_PATH).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.createDateTimeField(FIELD_ISSUE_FUNC_CREATED_AT);
    mapping.createDateTimeField(FIELD_ISSUE_FUNC_UPDATED_AT);
    mapping.createDateTimeField(FIELD_ISSUE_FUNC_CLOSED_AT);
    mapping.keywordFieldBuilder(FIELD_ISSUE_KEY).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_SCOPE).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_LANGUAGE).disableNorms().build();
    mapping.createIntegerField(FIELD_ISSUE_LINE);
    mapping.keywordFieldBuilder(FIELD_ISSUE_MODULE_UUID).disableNorms().build();
    mapping.createUuidPathField(FIELD_ISSUE_MODULE_PATH);
    mapping.keywordFieldBuilder(FIELD_ISSUE_PROJECT_UUID).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_BRANCH_UUID).disableNorms().build();
    mapping.createBooleanField(FIELD_ISSUE_IS_MAIN_BRANCH);
    mapping.keywordFieldBuilder(FIELD_ISSUE_DIRECTORY_PATH).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_RESOLUTION).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_RULE_UUID).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_SEVERITY).disableNorms().build();
    mapping.createByteField(FIELD_ISSUE_SEVERITY_VALUE);
    mapping.keywordFieldBuilder(FIELD_ISSUE_STATUS).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_TAGS).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_TYPE).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_OWASP_TOP_10).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_SANS_TOP_25).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_CWE).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_SQ_SECURITY_CATEGORY).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_ISSUE_VULNERABILITY_PROBABILITY).disableNorms().build();
    mapping.createBooleanField(FIELD_ISSUE_NEW_CODE_REFERENCE);
}
Also used : NewAuthorizedIndex(org.sonar.server.es.newindex.NewAuthorizedIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Example 3 with NewAuthorizedIndex

use of org.sonar.server.es.newindex.NewAuthorizedIndex in project sonarqube by SonarSource.

the class ProjectMeasuresIndexDefinition method define.

@Override
public void define(IndexDefinitionContext context) {
    NewAuthorizedIndex index = context.createWithAuthorization(DESCRIPTOR, newBuilder(config).setRefreshInterval(MANUAL_REFRESH_INTERVAL).setDefaultNbOfShards(5).build()).setEnableSource(enableSource);
    TypeMapping mapping = index.createTypeMapping(TYPE_PROJECT_MEASURES);
    mapping.keywordFieldBuilder(FIELD_UUID).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_KEY).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_QUALIFIER).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_NAME).addSubFields(SORTABLE_ANALYZER, SEARCH_GRAMS_ANALYZER).build();
    mapping.keywordFieldBuilder(FIELD_QUALITY_GATE_STATUS).build();
    mapping.keywordFieldBuilder(FIELD_TAGS).build();
    mapping.keywordFieldBuilder(FIELD_LANGUAGES).build();
    mapping.nestedFieldBuilder(FIELD_MEASURES).addKeywordField(SUB_FIELD_MEASURES_KEY).addDoubleField(SUB_FIELD_MEASURES_VALUE).build();
    mapping.nestedFieldBuilder(FIELD_NCLOC_DISTRIBUTION).addKeywordField(SUB_FIELD_DISTRIB_LANGUAGE).addIntegerField(SUB_FIELD_DISTRIB_NCLOC).build();
    mapping.createDateTimeField(FIELD_ANALYSED_AT);
}
Also used : NewAuthorizedIndex(org.sonar.server.es.newindex.NewAuthorizedIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Example 4 with NewAuthorizedIndex

use of org.sonar.server.es.newindex.NewAuthorizedIndex in project sonarqube by SonarSource.

the class ComponentIndexDefinition method define.

@Override
public void define(IndexDefinitionContext context) {
    NewAuthorizedIndex index = context.createWithAuthorization(DESCRIPTOR, newBuilder(config).setRefreshInterval(MANUAL_REFRESH_INTERVAL).setDefaultNbOfShards(DEFAULT_NUMBER_OF_SHARDS).build()).setEnableSource(enableSource);
    TypeMapping mapping = index.createTypeMapping(TYPE_COMPONENT);
    mapping.keywordFieldBuilder(FIELD_UUID).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_PROJECT_UUID).disableNorms().build();
    mapping.keywordFieldBuilder(FIELD_KEY).addSubFields(SORTABLE_ANALYZER).build();
    mapping.textFieldBuilder(FIELD_NAME).withFieldData().store().termVectorWithPositionOffsets().addSubFields(NAME_ANALYZERS).build();
    mapping.keywordFieldBuilder(FIELD_QUALIFIER).build();
}
Also used : NewAuthorizedIndex(org.sonar.server.es.newindex.NewAuthorizedIndex) TypeMapping(org.sonar.server.es.newindex.TypeMapping)

Aggregations

NewAuthorizedIndex (org.sonar.server.es.newindex.NewAuthorizedIndex)4 TypeMapping (org.sonar.server.es.newindex.TypeMapping)3 MapSettings (org.sonar.api.config.internal.MapSettings)1