Examples of searcher()


Examples of org.elasticsearch.index.shard.service.IndexShard.searcher()

    private void loadQueries(String indexName) {
        IndexService indexService = percolatorIndexService();
        IndexShard shard = indexService.shard(0);
        shard.refresh(new Engine.Refresh(true));
        Engine.Searcher searcher = shard.searcher();
        try {
            // create a query to fetch all queries that are registered under the index name (which is the type
            // in the percolator).
            Query query = new DeletionAwareConstantScoreQuery(indexQueriesFilter(indexName));
            QueriesLoaderCollector queries = new QueriesLoaderCollector();
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.searcher()

            }
            if (percolatorIndex.numberOfShards() == 0) {
                throw new PercolateIndexUnavailable(new Index(PercolatorService.INDEX_NAME));
            }
            IndexShard percolatorShard = percolatorIndex.shard(0);
            Engine.Searcher percolatorSearcher = percolatorShard.searcher();
            try {
                percolatorSearcher.searcher().search(request.query(), new QueryCollector(logger, queries, searcher, percolatorIndex, matches));
            } catch (IOException e) {
                logger.warn("failed to execute", e);
            } finally {
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.searcher()

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

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

        Engine.Searcher engineSearcher = indexShard.searcher();
        SearchContext context = new SearchContext(idGenerator.incrementAndGet(), shardTarget, request.searchType(), request.numberOfShards(), request.timeout(), request.types(), engineSearcher, indexService, scriptService);
        SearchContext.setCurrent(context);
        try {
            context.scroll(request.scroll());
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.searcher()

        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();
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.searcher()

        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);
View Full Code Here

Examples of org.elasticsearch.index.shard.service.InternalIndexShard.searcher()

        }
        if (indexShard.state() == IndexShardState.STARTED) {
//            shardStatus.estimatedFlushableMemorySize = indexShard.estimateFlushableMemorySize();
            shardStatus.translogId = indexShard.translog().currentId();
            shardStatus.translogOperations = indexShard.translog().estimatedNumberOfOperations();
            Engine.Searcher searcher = indexShard.searcher();
            try {
                shardStatus.docs = new DocsStatus();
                shardStatus.docs.numDocs = searcher.reader().numDocs();
                shardStatus.docs.maxDoc = searcher.reader().maxDoc();
                shardStatus.docs.deletedDocs = searcher.reader().numDeletedDocs();
View Full Code Here

Examples of org.elasticsearch.search.internal.DefaultSearchContext.searcher()

        try {
            context.parsedQuery(indexService.queryParserService().parseQuery(request.source()));
            context.preProcess();
            int topLevelDocId = result.docIdAndVersion().docId + result.docIdAndVersion().context.docBase;
            Explanation explanation = context.searcher().explain(context.query(), topLevelDocId);
            for (RescoreSearchContext ctx : context.rescore()) {
                Rescorer rescorer = ctx.rescorer();
                explanation = rescorer.explain(topLevelDocId, context, ctx, explanation);
            }
            if (request.fields() != null || (request.fetchSourceContext() != null && request.fetchSourceContext().fetchSource())) {
View Full Code Here

Examples of org.elasticsearch.search.internal.DefaultSearchContext.searcher()

                }
            }
            context.preProcess();
            try {
                Lucene.EarlyTerminatingCollector existsCollector = Lucene.createExistsCollector();
                Lucene.exists(context.searcher(), context.query(), existsCollector);
                return new ShardExistsResponse(request.shardId(), existsCollector.exists());
            } catch (Exception e) {
                throw new QueryPhaseExecutionException(context, "failed to execute exists", e);
            }
        } finally {
View Full Code Here

Examples of org.elasticsearch.search.internal.DefaultSearchContext.searcher()

            try {
                long count;
                if (hasTerminateAfterCount) {
                    final Lucene.EarlyTerminatingCollector countCollector =
                            Lucene.createCountBasedEarlyTerminatingCollector(request.terminateAfter());
                    terminatedEarly = Lucene.countWithEarlyTermination(context.searcher(), context.query(), countCollector);
                    count = countCollector.count();
                } else {
                    count = Lucene.count(context.searcher(), context.query());
                }
                return new ShardCountResponse(request.shardId(), count, terminatedEarly);
View Full Code Here

Examples of org.elasticsearch.search.internal.DefaultSearchContext.searcher()

                    final Lucene.EarlyTerminatingCollector countCollector =
                            Lucene.createCountBasedEarlyTerminatingCollector(request.terminateAfter());
                    terminatedEarly = Lucene.countWithEarlyTermination(context.searcher(), context.query(), countCollector);
                    count = countCollector.count();
                } else {
                    count = Lucene.count(context.searcher(), context.query());
                }
                return new ShardCountResponse(request.shardId(), count, terminatedEarly);
            } catch (Exception e) {
                throw new QueryPhaseExecutionException(context, "failed to execute count", e);
            }
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.