Package org.elasticsearch.search

Examples of org.elasticsearch.search.SearchShardTarget


                              List<LuceneCollectorExpression<?>> collectorExpressions,
                              Functions functions,
                              WhereClause whereClause,
                              Projector downStreamProjector) throws Exception {
        downstream(downStreamProjector);
        SearchShardTarget searchShardTarget = new SearchShardTarget(
                clusterService.localNode().id(), shardId.getIndex(), shardId.id());
        this.topLevelInputs = inputs;
        this.collectorExpressions = collectorExpressions;
        this.fieldsVisitor = new CollectorFieldsVisitor(collectorExpressions.size());
View Full Code Here


     */
    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()
        );

View Full Code Here

        public void onResponse(QuerySearchResult querySearchResult) {
            Tuple<String, QueryShardRequest> requestTuple = requests.get(requestIdx);
            QueryShardRequest request = requestTuple.v2();

            querySearchResult.shardTarget(
                    new SearchShardTarget(requestTuple.v1(), request.index(), request.shardId()));
            firstResults.set(requestIdx, querySearchResult);
            if (totalOps.incrementAndGet() == expectedOps) {
                try {
                    moveToSecondPhase();
                } catch (IOException e) {
View Full Code Here

        IndexService indexService = indicesService.indexServiceSafe(
                request.index());
        IndexShard indexShard = indexService.shardSafe(request.shardId());

        SearchShardTarget shardTarget = new SearchShardTarget(
                clusterService.localNode().id(), request.index(),
                request.shardId());
        SearchIntoContext context = new SearchIntoContext(0,
            new ShardSearchRequest().types(request.types()).filteringAliases(request.filteringAliases()),
            shardTarget, indexShard.searcher(), indexService, indexShard, scriptService, cacheRecycler
        );
        SearchIntoContext.setCurrent(context);

        try {
            BytesReference source = request.source();
            parser.parseSource(context, source);
            context.preProcess();
            try {
                if (context.explain()) {
                    return new ShardSearchIntoResponse(
                            shardTarget.nodeIdText(), request.index(),
                            request.shardId());
                } else {
                    WriterResult res = writer.execute(context);
                    return new ShardSearchIntoResponse(
                            shardTarget.nodeIdText(), request.index(),
                            request.shardId(), res);
                }

            } catch (Exception e) {
                throw new QueryPhaseExecutionException(context,
View Full Code Here


        IndexService indexService = indicesService.indexServiceSafe(request.index());
        IndexShard indexShard = indexService.shardSafe(request.shardId());

        SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.index(), request.shardId());
        ExportContext context = new ExportContext(0,
            new ShardSearchRequest().types(request.types()).filteringAliases(request.filteringAliases()),
            shardTarget, indexShard.searcher(), indexService, indexShard, scriptService, cacheRecycler, nodePath);
        ExportContext.setCurrent(context);

        try {
            BytesReference source = request.source();
            exportParser.parseSource(context, source);
            context.preProcess();
            exporter.check(context);
            try {
                if (context.explain()) {
                    return new ShardExportResponse(shardTarget.nodeIdText(), request.index(), request.shardId(), context.outputCmd(), context.outputCmdArray(), context.outputFile());
                } else {
                    Exporter.Result res = exporter.execute(context);
                    return new ShardExportResponse(shardTarget.nodeIdText(), request.index(), request.shardId(), context.outputCmd(), context.outputCmdArray(), context.outputFile(), res.outputResult.stdErr, res.outputResult.stdOut, res.outputResult.exit, res.numExported);
                }

            } catch (Exception e) {
                throw new QueryPhaseExecutionException(context, "failed to execute export", e);
            }
View Full Code Here

                    ArrayList<SnapshotShardFailure> shardFailures = newArrayList();
                    for (Map.Entry<ShardId, ShardSnapshotStatus> shardStatus : entry.shards().entrySet()) {
                        ShardId shardId = shardStatus.getKey();
                        ShardSnapshotStatus status = shardStatus.getValue();
                        if (status.state().failed()) {
                            failures.add(new ShardSearchFailure(status.reason(), new SearchShardTarget(status.nodeId(), shardId.getIndex(), shardId.id())));
                            shardFailures.add(new SnapshotShardFailure(status.nodeId(), shardId.getIndex(), shardId.id(), status.reason()));
                        }
                    }
                    Snapshot snapshot = repository.finalizeSnapshot(snapshotId, failure, entry.shards().size(), ImmutableList.copyOf(shardFailures));
                    removeSnapshotFromClusterState(snapshotId, new SnapshotInfo(snapshot), null);
View Full Code Here

                }
            }
        }

        void onFirstPhaseResult(int shardIndex, ShardRouting shard, FirstResult result, ShardIterator shardIt) {
            result.shardTarget(new SearchShardTarget(shard.currentNodeId(), shard.index(), shard.id()));
            processFirstPhaseResult(shardIndex, shard, result);
            // we need to increment successful ops first before we compare the exit condition otherwise if we
            // are fast we could concurrently update totalOps but then preempt one of the threads which can
            // cause the successor to read a wrong value from successfulOps if second phase is very fast ie. count etc.
            successfulOps.incrementAndGet();
View Full Code Here

        }

        void onFirstPhaseResult(final int shardIndex, @Nullable ShardRouting shard, @Nullable String nodeId, final ShardIterator shardIt, Throwable t) {
            // we always add the shard failure for a specific shard instance
            // we do make sure to clean it on a successful response from a shard
            SearchShardTarget shardTarget = new SearchShardTarget(nodeId, shardIt.shardId().getIndex(), shardIt.shardId().getId());
            addShardFailure(shardIndex, shardTarget, t);

            if (totalOps.incrementAndGet() == expectedTotalOps) {
                if (logger.isDebugEnabled()) {
                    if (t != null && !TransportActions.isShardNotAvailableException(t)) {
View Full Code Here

    @Override
    protected ShardExistsResponse shardOperation(ShardExistsRequest request) throws ElasticsearchException {
        IndexService indexService = indicesService.indexServiceSafe(request.shardId().getIndex());
        IndexShard indexShard = indexService.shardSafe(request.shardId().id());

        SearchShardTarget shardTarget = new SearchShardTarget(clusterService.localNode().id(), request.shardId().getIndex(), request.shardId().id());
        SearchContext context = new DefaultSearchContext(0,
                new ShardSearchLocalRequest(request.types(), request.nowInMillis(), request.filteringAliases()),
                shardTarget, indexShard.acquireSearcher("exists"), indexService, indexShard,
                scriptService, pageCacheRecycler, bigArrays, threadPool.estimatedTimeInMillisCounter());
        SearchContext.setCurrent(context);
View Full Code Here

        ShardPercolateService shardPercolateService = indexShard.shardPercolateService();
        shardPercolateService.prePercolate();
        long startTime = System.nanoTime();

        SearchShardTarget searchShardTarget = new SearchShardTarget(clusterService.localNode().id(), request.shardId().getIndex(), request.shardId().id());
        final PercolateContext context = new PercolateContext(
                request, searchShardTarget, indexShard, percolateIndexService, pageCacheRecycler, bigArrays, scriptService
        );
        try {
            ParsedDocument parsedDocument = parseRequest(percolateIndexService, request, context);
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.SearchShardTarget

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.