Package org.elasticsearch.index.service

Examples of org.elasticsearch.index.service.IndexService


        }
        super.doExecute(request, listener);
    }

    @Override protected MultiGetShardResponse shardOperation(MultiGetShardRequest request, int shardId) throws ElasticSearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        IndexShard indexShard = indexService.shardSafe(shardId);

        if (request.refresh() && !request.realtime()) {
            indexShard.refresh(new Engine.Refresh(false));
        }
View Full Code Here


    public void startRecovery(final StartRecoveryRequest request, final boolean fromRetry, final RecoveryListener listener) {
        if (request.sourceNode() == null) {
            listener.onIgnoreRecovery(false, "No node to recover from, retry on next cluster state update");
            return;
        }
        IndexService indexService = indicesService.indexService(request.shardId().index().name());
        if (indexService == null) {
            removeAndCleanOnGoingRecovery(request.shardId());
            listener.onIgnoreRecovery(false, "index missing locally, stop recovery");
            return;
        }
        final InternalIndexShard shard = (InternalIndexShard) indexService.shard(request.shardId().id());
        if (shard == null) {
            removeAndCleanOnGoingRecovery(request.shardId());
            listener.onIgnoreRecovery(false, "shard missing locally, stop recovery");
            return;
        }
View Full Code Here

        request.index(clusterState.metaData().concreteIndex(request.index()));
        return clusterState.routingTable().index(request.index()).randomAllActiveShardsIt();
    }

    @Override protected PercolateResponse shardOperation(PercolateRequest request, int shardId) throws ElasticSearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        PercolatorService percolatorService = indexService.percolateService();

        PercolatorExecutor.Response percolate = percolatorService.percolate(new PercolatorExecutor.SourceRequest(request.type(), request.source()));
        return new PercolateResponse(percolate.matches());
    }
View Full Code Here

    @Override protected void postPrimaryOperation(IndexRequest request, PrimaryResponse<IndexResponse> response) {
        Engine.IndexingOperation op = (Engine.IndexingOperation) response.payload();
        if (!Strings.hasLength(request.percolate())) {
            return;
        }
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        try {
            PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), request.percolate()));
            response.response().matches(percolate.matches());
        } catch (Exception e) {
            logger.warn("failed to percolate [{}]", e, request);
        }
    }
View Full Code Here

        request.index(clusterState.metaData().concreteIndex(request.index()));
        return clusterState.routingTable().index(request.index()).randomAllActiveShardsIt();
    }

    @Override protected AnalyzeResponse shardOperation(AnalyzeRequest request, int shardId) throws ElasticSearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        Analyzer analyzer = null;
        String field = null;
        if (request.field() != null) {
            FieldMapper fieldMapper = indexService.mapperService().smartNameFieldMapper(request.field());
            if (fieldMapper != null) {
                analyzer = fieldMapper.indexAnalyzer();
                field = fieldMapper.names().indexName();
            }
        }
        if (field == null) {
            field = "_all";
        }
        if (analyzer == null && request.analyzer() != null) {
            analyzer = indexService.analysisService().analyzer(request.analyzer());
        } else if (analyzer == null) {
            analyzer = indexService.analysisService().defaultIndexAnalyzer();
        }
        if (analyzer == null) {
            throw new ElasticSearchIllegalArgumentException("failed to find analyzer");
        }
View Full Code Here

        // when the shard is deleted (or moved to another cluster instance)
        // using this in the above case fails, because i cannot get the indexService anymore at beforeIndexShardClosed()
        indicesService.indicesLifecycle().addListener(new IndicesLifecycle.Listener() {
            @Override
            public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard) {
                IndexService indexService = indicesService.indexService(shardId.index().name());
                if (indexService != null) {
                    ShardSuggestService suggestShardService = indexService.shardInjectorSafe(shardId.id()).getInstance(ShardSuggestService.class);
                    suggestShardService.shutDown();
                }
            }
        });
    }
View Full Code Here

    }

    @Override
    protected ShardSuggestRefreshResponse shardOperation(ShardSuggestRefreshRequest request) throws ElasticsearchException {
        logger.trace("Entered TransportSuggestRefreshAction.shardOperation()");
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        ShardSuggestService suggestShardService = indexService.shardInjectorSafe(request.shardId()).getInstance(ShardSuggestService.class);
        return suggestShardService.refresh(request);
    }
View Full Code Here

    }

    @Override
    protected ShardSuggestResponse shardOperation(ShardSuggestRequest request) throws ElasticsearchException {
        logger.trace("Entered TransportSuggestAction.shardOperation()");
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        ShardSuggestService suggestShardService = indexService.shardInjectorSafe(request.shardId()).getInstance(ShardSuggestService.class);
        return suggestShardService.suggest(request);
    }
View Full Code Here

        return new ShardSuggestStatisticsResponse();
    }

    @Override
    protected ShardSuggestStatisticsResponse shardOperation(ShardSuggestStatisticsRequest request) throws ElasticsearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.index());
        ShardSuggestService suggestShardService = indexService.shardInjectorSafe(request.shardId()).getInstance(ShardSuggestService.class);
        return suggestShardService.getStatistics();
    }
View Full Code Here

      if (output_mode == null) {
         output_mode = (output_script != null) ? HashedStringsFacetCollector.OUTPUT_MODE.SCRIPT :
                 HashedStringsFacetCollector.OUTPUT_MODE.TERM;
      }

      IndexService indexService = indicesService.indexService(context.indexShard().shardId().getIndex());

      HashedStringFieldSettings fieldSettings = indexService.shardInjectorSafe(context.indexShard().shardId().id()).
              getInstance(HashedStringFieldSettings.class);

      HashedStringFieldSettings.FieldTypeFactory fieldTypeFactory = fieldSettings.fieldTypeFactory;

      return new HashedStringsFacetCollector(facetName, field, size, fetch_size, comparatorType, allTerms,
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.service.IndexService

Copyright © 2018 www.massapicom. 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.