Examples of IndexShard


Examples of org.elasticsearch.index.shard.service.IndexShard

        return new PrimaryResponse<ShardDeleteResponse>(response, null);
    }

    @Override protected void shardOperationOnReplica(ShardOperationRequest shardRequest) {
        ShardDeleteRequest request = shardRequest.request;
        IndexShard indexShard = indexShard(shardRequest);
        Engine.Delete delete = indexShard.prepareDelete(request.type(), request.id(), request.version())
                .origin(Engine.Operation.Origin.REPLICA);
        indexShard.delete(delete);

        if (request.refresh()) {
            try {
                indexShard.refresh(new Engine.Refresh(false));
            } catch (Exception e) {
                // ignore
            }
        }
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

    @Override protected ShardRefreshResponse newShardResponse() {
        return new ShardRefreshResponse();
    }

    @Override protected ShardRefreshResponse shardOperation(ShardRefreshRequest request) throws ElasticSearchException {
        IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
        indexShard.refresh(new Engine.Refresh(request.waitForOperations()));
        return new ShardRefreshResponse(request.index(), request.shardId());
    }
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

        return new ShardOptimizeResponse();
    }

    @Override protected ShardOptimizeResponse shardOperation(ShardOptimizeRequest request) throws ElasticSearchException {
        synchronized (optimizeMutex) {
            IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
            indexShard.optimize(new Engine.Optimize()
                    .waitForMerge(request.waitForMerge())
                    .maxNumSegments(request.maxNumSegments())
                    .onlyExpungeDeletes(request.onlyExpungeDeletes())
                    .flush(request.flush())
                    .refresh(request.refresh())
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

        // When the instance is shut down or the index is deleted
        indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
            @Override
            public void beforeIndexClosed(IndexService indexService) {
                for (Iterator<IndexShard> shardServiceIterator = indexService.iterator(); shardServiceIterator.hasNext(); ) {
                    IndexShard indexShard  = shardServiceIterator.next();
                    ShardSuggestService suggestShardService = indexService.shardInjectorSafe(indexShard.shardId().id()).getInstance(ShardSuggestService.class);
                    suggestShardService.shutDown();
                }
            }
        });
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

            this.shardIdExpression = new ShardIdExpression(this.shardId);
        }

        @Override
        protected void configure() {
            IndexShard shard = mock(InternalIndexShard.class);
            bind(IndexShard.class).toInstance(shard);
            Index index = new Index(TEST_TABLE_NAME);
            bind(Index.class).toInstance(index);
            bind(ShardId.class).toInstance(shardId);
            MapBinder<ReferenceIdent, ShardReferenceImplementation> binder = MapBinder
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

            this.shardIdExpression = new ShardIdExpression(this.shardId);
        }

        @Override
        protected void configure() {
            IndexShard shard = mock(InternalIndexShard.class);
            bind(IndexShard.class).toInstance(shard);
            Index index = new Index(TEST_TABLE_NAME);
            bind(Index.class).toInstance(index);
            bind(ShardId.class).toInstance(shardId);
            MapBinder<ReferenceIdent, ShardReferenceImplementation> binder = MapBinder
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

        this.collectorExpressions = collectorExpressions;
        this.fieldsVisitor = new CollectorFieldsVisitor(collectorExpressions.size());

        ShardSearchRequest shardSearchRequest = new ShardSearchRequest();
        shardSearchRequest.types(new String[]{Constants.DEFAULT_MAPPING_TYPE});
        IndexShard indexShard = indexService.shardSafe(shardId.id());
        searchContext = new DefaultSearchContext(0, shardSearchRequest,
                searchShardTarget,
                indexShard.acquireSearcher("search"),
                indexService,
                indexShard,
                scriptService,
                cacheRecycler,
                pageCacheRecycler,
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

     * Note: Scrolling isn't supported.
     * </p>
     */
    private SearchContext createContext(QueryShardRequest request, @Nullable Engine.Searcher searcher) {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        IndexShard indexShard = indexService.shardSafe(request.shardId());

        SearchShardTarget searchShardTarget = new SearchShardTarget(
                clusterService.localNode().id(),
                request.index(),
                request.shardId()
        );

        Engine.Searcher engineSearcher = searcher == null ? indexShard.acquireSearcher("search") : searcher;

        ShardSearchRequest shardSearchRequest = new ShardSearchRequest();
        shardSearchRequest.types(new String[] {Constants.DEFAULT_MAPPING_TYPE });

        // TODO: use own CrateSearchContext that doesn't require ShardSearchRequest
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

                    return indexName;
                }
            });
            bind(ShardId.class).toInstance(shardId);

            IndexShard indexShard = mock(IndexShard.class);
            bind(IndexShard.class).toInstance(indexShard);

            StoreStats storeStats = mock(StoreStats.class);
            when(indexShard.storeStats()).thenReturn(storeStats);
            when(storeStats.getSizeInBytes()).thenReturn(123456L);

            DocsStats docsStats = mock(DocsStats.class);
            when(indexShard.docStats()).thenReturn(docsStats).thenThrow(IllegalIndexShardStateException.class);
            when(docsStats.getCount()).thenReturn(654321L);

            ShardRouting shardRouting = mock(ShardRouting.class);
            when(indexShard.routingEntry()).thenReturn(shardRouting);
            when(shardRouting.primary()).thenReturn(true);
            when(shardRouting.relocatingNodeId()).thenReturn("node_X");

            TransportPutIndexTemplateAction transportPutIndexTemplateAction = mock(TransportPutIndexTemplateAction.class);
            bind(TransportPutIndexTemplateAction.class).toInstance(transportPutIndexTemplateAction);

            when(indexShard.state()).thenReturn(IndexShardState.STARTED);

            MetaData metaData = mock(MetaData.class);
            when(metaData.hasConcreteIndex(Constants.PARTITIONED_TABLE_PREFIX + ".wikipedia_de._1")).thenReturn(false);
            ClusterState clusterState = mock(ClusterState.class);
            when(clusterService.state()).thenReturn(clusterState);
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard

            //if (!request.shardId().index().equals(blobService.getIndex())){
            //    throw new IllegalStateException(
            //            String.format("tried blob recovery on none-blob index {}", request.shardId().index()));
            //}

            IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().index().name())
                                                  .shardSafe(request.shardId().id());
            RecoveryStatus onGoingIndexRecovery = indexRecoveryTarget.recoveryStatus(indexShard);

            if (onGoingIndexRecovery.isCanceled()) {
                throw new IndexShardClosedException(request.shardId());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.