Search in sources :

Example 1 with ALL_INDICES

use of org.sonar.server.es.Index.ALL_INDICES in project sonarqube by SonarSource.

the class EsTester method after.

@Override
protected void after() {
    if (isCustom) {
        // delete non-core indices
        String[] existingIndices = getIndicesNames();
        Stream.of(existingIndices).filter(i -> !CORE_INDICES_NAMES.contains(i)).forEach(EsTester::deleteIndexIfExists);
    }
    BulkIndexer.delete(ES_REST_CLIENT, IndexType.main(ALL_INDICES, "dummy"), EsClient.prepareSearch(ALL_INDICES.getName()).source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())));
}
Also used : IndexRelationType(org.sonar.server.es.IndexType.IndexRelationType) BuiltIndex(org.sonar.server.es.newindex.BuiltIndex) ComponentIndexDefinition(org.sonar.server.component.index.ComponentIndexDefinition) Environment(org.elasticsearch.env.Environment) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ALL_INDICES(org.sonar.server.es.Index.ALL_INDICES) Random(java.util.Random) Collections2(com.google.common.collect.Collections2) BindHttpException(org.elasticsearch.http.BindHttpException) QueryBuilders(org.elasticsearch.index.query.QueryBuilders) ParentJoinPlugin(org.elasticsearch.join.ParentJoinPlugin) NodeValidationException(org.elasticsearch.node.NodeValidationException) ServerSocket(java.net.ServerSocket) RecoverySettings(org.elasticsearch.indices.recovery.RecoverySettings) Loggers(org.sonar.api.utils.log.Loggers) IndexRequest(org.elasticsearch.action.index.IndexRequest) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Settings(org.elasticsearch.common.settings.Settings) Map(java.util.Map) SearchResponse(org.elasticsearch.action.search.SearchResponse) RequestOptions(org.elasticsearch.client.RequestOptions) HttpTransportSettings(org.elasticsearch.http.HttpTransportSettings) ElasticsearchStatusException(org.elasticsearch.ElasticsearchStatusException) Path(java.nio.file.Path) TimeValue(org.elasticsearch.core.TimeValue) SearchHit(org.elasticsearch.search.SearchHit) ImmutableMap(com.google.common.collect.ImmutableMap) ConstructorUtils(org.apache.commons.lang.reflect.ConstructorUtils) BulkResponse(org.elasticsearch.action.bulk.BulkResponse) REFRESH_IMMEDIATE(org.sonar.server.es.newindex.DefaultIndexSettings.REFRESH_IMMEDIATE) Set(java.util.Set) ProjectMeasuresIndexDefinition(org.sonar.server.measure.index.ProjectMeasuresIndexDefinition) Netty4Plugin(org.elasticsearch.transport.Netty4Plugin) IndexDefinitionContext(org.sonar.server.es.IndexDefinition.IndexDefinitionContext) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) List(java.util.List) Stream(java.util.stream.Stream) ExternalResource(org.junit.rules.ExternalResource) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) ClusterHealthRequest(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest) CreateIndexResponse(org.elasticsearch.client.indices.CreateIndexResponse) SortOrder(org.elasticsearch.search.sort.SortOrder) RuleIndexDefinition(org.sonar.server.rule.index.RuleIndexDefinition) IssueIndexDefinition(org.sonar.server.issue.index.IssueIndexDefinition) ViewIndexDefinition(org.sonar.server.view.index.ViewIndexDefinition) GetIndexRequest(org.elasticsearch.client.indices.GetIndexRequest) Iterables(com.google.common.collect.Iterables) ClearScrollRequest(org.elasticsearch.action.search.ClearScrollRequest) DiskThresholdSettings(org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) InternalSettingsPreparer(org.elasticsearch.node.InternalSettingsPreparer) SearchRequest(org.elasticsearch.action.search.SearchRequest) ArrayList(java.util.ArrayList) UpdateSettingsRequest(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest) Strings(org.elasticsearch.common.Strings) DatagramSocket(java.net.DatagramSocket) HashSet(java.util.HashSet) ImmutableList(com.google.common.collect.ImmutableList) DiscoveryModule(org.elasticsearch.discovery.DiscoveryModule) CommonAnalysisPlugin(org.elasticsearch.analysis.common.CommonAnalysisPlugin) Node(org.elasticsearch.node.Node) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder) FIELD_INDEX_TYPE(org.sonar.server.es.IndexType.FIELD_INDEX_TYPE) NoSuchElementException(java.util.NoSuchElementException) Logger(org.sonar.api.utils.log.Logger) QueryBuilder(org.elasticsearch.index.query.QueryBuilder) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest) QueryBuilders.matchAllQuery(org.elasticsearch.index.query.QueryBuilders.matchAllQuery) CreateIndexRequest(org.elasticsearch.client.indices.CreateIndexRequest) Files(java.nio.file.Files) Throwables(com.google.common.base.Throwables) UserIndexDefinition(org.sonar.server.user.index.UserIndexDefinition) IOException(java.io.IOException) AcknowledgedResponse(org.elasticsearch.action.support.master.AcknowledgedResponse) RestHighLevelClient(org.elasticsearch.client.RestHighLevelClient) TermQueryBuilder(org.elasticsearch.index.query.TermQueryBuilder) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) NewIndex(org.sonar.server.es.newindex.NewIndex) PutMappingRequest(org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest) SearchScrollRequest(org.elasticsearch.action.search.SearchScrollRequest) ClusterHealthStatus(org.elasticsearch.cluster.health.ClusterHealthStatus) Collections(java.util.Collections) HttpHost(org.apache.http.HttpHost) BulkRequest(org.elasticsearch.action.bulk.BulkRequest) SearchSourceBuilder(org.elasticsearch.search.builder.SearchSourceBuilder)

Aggregations

Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Throwables (com.google.common.base.Throwables)1 Collections2 (com.google.common.collect.Collections2)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterables (com.google.common.collect.Iterables)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 DatagramSocket (java.net.DatagramSocket)1 ServerSocket (java.net.ServerSocket)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 NoSuchElementException (java.util.NoSuchElementException)1