Package org.elasticsearch.search
Class MockSearchService
java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.search.SearchService
org.elasticsearch.search.MockSearchService
- All Implemented Interfaces:
Closeable,AutoCloseable,LifecycleComponent,Releasable,IndexEventListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMarker plugin used byMockNodeto enableMockSearchService.Nested classes/interfaces inherited from class org.elasticsearch.search.SearchService
SearchService.ResultsType -
Field Summary
Fields inherited from class org.elasticsearch.search.SearchService
ALLOW_EXPENSIVE_QUERIES, BATCHED_QUERY_PHASE, CCS_COLLECT_TELEMETRY, CCS_VERSION_CHECK_SETTING, DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS, DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS_SETTING, DEFAULT_FROM, DEFAULT_KEEPALIVE_SETTING, DEFAULT_SEARCH_TIMEOUT_SETTING, DEFAULT_SIZE, ENABLE_REWRITE_AGGS_TO_FILTER_BY_FILTER, FETCH_PHASE_CHUNKED_ENABLED, FETCH_PHASE_CHUNKED_TARGET_CHUNK_BYTES, FETCH_PHASE_MAX_IN_FLIGHT_CHUNKS, KEEPALIVE_INTERVAL_SETTING, LOW_LEVEL_CANCELLATION_SETTING, MAX_ASYNC_SEARCH_RESPONSE_SIZE_SETTING, MAX_KEEPALIVE_SETTING, MAX_OPEN_SCROLL_CONTEXT, MEMORY_ACCOUNTING_BUFFER_SIZE, MINIMUM_DOCS_PER_SLICE, NO_TIMEOUT, PIT_RELOCATION_ENABLED, PIT_RELOCATION_FEATURE_FLAG, PREWARMING_THRESHOLD_THREADPOOL_SIZE_FACTOR_POOL_SIZE, QUERY_PHASE_PARALLEL_COLLECTION_ENABLED, SEARCH_WORKER_THREADS_ENABLEDFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionMockSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector, Tracer tracer, OnlinePrewarmingService onlinePrewarmingService) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidThrow anAssertionErrorif there are still in-flight contexts.protected voidprotected SearchContextcreateContext(ReaderContext readerContext, ShardSearchRequest request, CancellableTask task, SearchService.ResultsType resultsType, boolean includeAggregations) createSearchContext(ShardSearchRequest request, TimeValue timeout) protected voidputReaderContext(ReaderContext context) protected voidputRelocatedReaderContext(Long mappingKey, PitReaderContext context) protected ReaderContextvoidsetOnCheckCancelled(Function<CancellableTask, CancellableTask> onCheckCancelled) voidsetOnCreateSearchContext(Consumer<SearchContext> onCreateSearchContext) voidsetOnPutContext(Consumer<ReaderContext> onPutContext) voidsetOnRemoveContext(Consumer<ReaderContext> onRemoveContext) Methods inherited from class org.elasticsearch.search.SearchService
afterIndexRemoved, aggReduceContextBuilder, batchQueryPhase, beforeIndexShardCreated, buildAliasFilter, canMatch, canMatch, canRewriteToMatchNone, createAndPutRelocatedPitContext, defaultAllowPartialSearchResults, doClose, doStart, doStop, executeDfsPhase, executeFetchPhase, executeFetchPhase, executeQueryPhase, executeQueryPhase, executeQueryPhase, executeRankFeaturePhase, fetchPhaseChunked, freeAllScrollContexts, freeReaderContext, getActiveContexts, getActivePITContexts, getActivePITContexts, getBigArrays, getCircuitBreaker, getCoordinatorRewriteContextProvider, getDefaultKeepAliveInMillis, getIndicesService, getOpenScrollContexts, getRewriteContext, getRewriteContext, isPitRelocationEnabled, openReaderContext, openReaderContext, queryStillMatchesAfterRewriteMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.index.shard.IndexEventListener
afterFilesRestoredFromRepository, afterIndexCreated, afterIndexShardClosed, afterIndexShardClosing, afterIndexShardCreated, afterIndexShardDeleted, afterIndexShardRecovery, afterIndexShardStarted, beforeIndexAddedToCluster, beforeIndexCreated, beforeIndexRemoved, beforeIndexShardClosed, beforeIndexShardDeleted, beforeIndexShardRecovery, indexShardStateChanged, onStoreClosed, onStoreCreated, shardRoutingChanged
-
Constructor Details
-
MockSearchService
public MockSearchService(ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase, CircuitBreakerService circuitBreakerService, ExecutorSelector executorSelector, Tracer tracer, OnlinePrewarmingService onlinePrewarmingService)
-
-
Method Details
-
assertNoInFlightContext
public static void assertNoInFlightContext()Throw anAssertionErrorif there are still in-flight contexts.Note: this assertion can spuriously trip when
search.low_level_cancellationisfalse(a setting that is randomized byESIntegTestCase) and a test stops the coordinating node while a search is in-flight. With low-level cancellation disabled, the search is not canceled when the associated connection drops, leaving the reader context active long enough to fail this check. Tests that deliberately stop coordinators mid-search should override the setting via theirnodeSettings(e.g.search.low_level_cancellation: true) rather than relaxing this assertion, so that genuine context leaks remain detectable. -
putReaderContext
- Overrides:
putReaderContextin classSearchService
-
putRelocatedReaderContext
- Overrides:
putRelocatedReaderContextin classSearchService
-
removeReaderContext
- Overrides:
removeReaderContextin classSearchService
-
setOnPutContext
-
setOnRemoveContext
-
setOnCreateSearchContext
-
createContext
protected SearchContext createContext(ReaderContext readerContext, ShardSearchRequest request, CancellableTask task, SearchService.ResultsType resultsType, boolean includeAggregations) throws IOException - Overrides:
createContextin classSearchService- Throws:
IOException
-
createSearchContext
public SearchContext createSearchContext(ShardSearchRequest request, TimeValue timeout) throws IOException - Overrides:
createSearchContextin classSearchService- Throws:
IOException
-
setOnCheckCancelled
-
checkCancelled
- Overrides:
checkCancelledin classSearchService
-