Class TestSearchContext

java.lang.Object
org.elasticsearch.search.internal.SearchContext
org.elasticsearch.test.TestSearchContext
All Implemented Interfaces:
Closeable, AutoCloseable, org.elasticsearch.core.Releasable

public class TestSearchContext extends org.elasticsearch.search.internal.SearchContext
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static org.elasticsearch.search.SearchShardTarget
     

    Fields inherited from class org.elasticsearch.search.internal.SearchContext

    DEFAULT_TERMINATE_AFTER, DEFAULT_TRACK_TOTAL_HITS_UP_TO, releasables, TRACK_TOTAL_HITS_ACCURATE, TRACK_TOTAL_HITS_DISABLED
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestSearchContext​(org.elasticsearch.index.IndexService indexService)
     
    TestSearchContext​(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext)
     
    TestSearchContext​(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext, org.elasticsearch.index.shard.IndexShard indexShard, org.elasticsearch.search.internal.ContextIndexSearcher searcher)
     
    TestSearchContext​(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext, org.elasticsearch.index.shard.IndexShard indexShard, org.elasticsearch.search.internal.ContextIndexSearcher searcher, org.elasticsearch.search.internal.ScrollContext scrollContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRescore​(org.elasticsearch.search.rescore.RescoreContext rescore)
     
    void
    addSearchExt​(org.elasticsearch.search.SearchExtBuilder searchExtBuilder)
     
    org.elasticsearch.search.aggregations.SearchContextAggregations
     
    org.elasticsearch.search.internal.SearchContext
    aggregations​(org.elasticsearch.search.aggregations.SearchContextAggregations aggregations)
     
    org.elasticsearch.index.cache.bitset.BitsetFilterCache
     
    org.apache.lucene.search.Query
    buildFilteredQuery​(org.apache.lucene.search.Query query)
     
    org.elasticsearch.search.collapse.CollapseContext
     
    org.elasticsearch.search.internal.SearchContext
    collapse​(org.elasticsearch.search.collapse.CollapseContext collapse)
     
    org.elasticsearch.search.dfs.DfsSearchResult
     
    int[]
     
    org.elasticsearch.search.internal.SearchContext
    docIdsToLoad​(int[] docIdsToLoad, int docsIdsToLoadSize)
     
    int
     
    org.elasticsearch.search.fetch.subphase.FetchDocValuesContext
     
    org.elasticsearch.search.internal.SearchContext
    docValuesContext​(org.elasticsearch.search.fetch.subphase.FetchDocValuesContext docValuesContext)
     
    boolean
     
    void
    explain​(boolean explain)
     
    org.elasticsearch.search.fetch.subphase.FetchFieldsContext
     
    org.elasticsearch.search.internal.SearchContext
    fetchFieldsContext​(org.elasticsearch.search.fetch.subphase.FetchFieldsContext fetchFieldsContext)
     
    org.elasticsearch.search.fetch.FetchPhase
     
    org.elasticsearch.search.fetch.FetchSearchResult
     
    org.elasticsearch.search.fetch.subphase.FetchSourceContext
     
    org.elasticsearch.search.internal.SearchContext
    fetchSourceContext​(org.elasticsearch.search.fetch.subphase.FetchSourceContext fetchSourceContext)
     
    int
     
    org.elasticsearch.search.internal.SearchContext
    from​(int from)
     
    org.elasticsearch.search.profile.Profilers
     
    long
     
    org.elasticsearch.index.query.SearchExecutionContext
     
    org.elasticsearch.search.SearchExtBuilder
     
    org.elasticsearch.action.search.SearchShardTask
     
     
    void
    groupStats​(List<String> groupStats)
     
    boolean
     
    boolean
     
    boolean
     
    org.elasticsearch.search.fetch.subphase.highlight.SearchHighlightContext
     
    void
    highlight​(org.elasticsearch.search.fetch.subphase.highlight.SearchHighlightContext highlight)
     
    org.elasticsearch.search.internal.ShardSearchContextId
    id()
     
    org.elasticsearch.index.shard.IndexShard
     
    boolean
     
    boolean
     
     
    org.elasticsearch.search.internal.SearchContext
    minimumScore​(float minimumScore)
     
    int
     
    org.elasticsearch.index.query.ParsedQuery
     
    org.elasticsearch.search.internal.SearchContext
    parsedPostFilter​(org.elasticsearch.index.query.ParsedQuery postFilter)
     
    org.elasticsearch.index.query.ParsedQuery
     
    org.elasticsearch.search.internal.SearchContext
    parsedQuery​(org.elasticsearch.index.query.ParsedQuery query)
     
    void
    preProcess​(boolean rewrite)
     
    org.apache.lucene.search.Query
     
    Map<Class<?>,​org.apache.lucene.search.Collector>
     
    org.elasticsearch.search.query.QuerySearchResult
     
    org.elasticsearch.search.internal.ReaderContext
     
    org.elasticsearch.search.internal.ShardSearchRequest
     
    List<org.elasticsearch.search.rescore.RescoreContext>
     
    org.elasticsearch.search.fetch.subphase.ScriptFieldsContext
     
    org.elasticsearch.search.internal.ScrollContext
     
    org.apache.lucene.search.FieldDoc
     
    org.elasticsearch.search.internal.SearchContext
    searchAfter​(org.apache.lucene.search.FieldDoc searchAfter)
     
    org.elasticsearch.search.internal.ContextIndexSearcher
     
    org.elasticsearch.action.search.SearchType
     
    boolean
     
    void
    seqNoAndPrimaryTerm​(boolean seqNoAndPrimaryTerm)
     
    void
    setSearcher​(org.elasticsearch.search.internal.ContextIndexSearcher searcher)
     
    void
    setSize​(int size)
     
    void
    setTask​(org.elasticsearch.action.search.SearchShardTask task)
     
    org.elasticsearch.search.SearchShardTarget
     
    int
     
    org.elasticsearch.search.internal.SearchContext
    size​(int size)
     
    org.elasticsearch.search.sort.SortAndFormats
     
    org.elasticsearch.search.internal.SearchContext
    sort​(org.elasticsearch.search.sort.SortAndFormats sort)
     
     
    boolean
     
    org.elasticsearch.search.fetch.StoredFieldsContext
     
    org.elasticsearch.search.internal.SearchContext
    storedFieldsContext​(org.elasticsearch.search.fetch.StoredFieldsContext storedFieldsContext)
     
    org.elasticsearch.search.suggest.SuggestionSearchContext
     
    void
    suggest​(org.elasticsearch.search.suggest.SuggestionSearchContext suggest)
     
    int
     
    void
    terminateAfter​(int terminateAfter)
     
    org.elasticsearch.core.TimeValue
     
    void
    timeout​(org.elasticsearch.core.TimeValue timeout)
     
    boolean
     
    org.elasticsearch.search.internal.SearchContext
    trackScores​(boolean trackScores)
     
    int
     
    org.elasticsearch.search.internal.SearchContext
    trackTotalHitsUpTo​(int trackTotalHitsUpTo)
     
    boolean
     
    void
    version​(boolean version)
     

    Methods inherited from class org.elasticsearch.search.internal.SearchContext

    addReleasable, assignRescoreDocIds, close, hasOnlySuggest, innerHits, rescoreDocIds, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • SHARD_TARGET

      public static final org.elasticsearch.search.SearchShardTarget SHARD_TARGET
  • Constructor Details

    • TestSearchContext

      public TestSearchContext(org.elasticsearch.index.IndexService indexService)
    • TestSearchContext

      public TestSearchContext(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext)
    • TestSearchContext

      public TestSearchContext(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext, org.elasticsearch.index.shard.IndexShard indexShard, org.elasticsearch.search.internal.ContextIndexSearcher searcher)
    • TestSearchContext

      public TestSearchContext(org.elasticsearch.index.query.SearchExecutionContext searchExecutionContext, org.elasticsearch.index.shard.IndexShard indexShard, org.elasticsearch.search.internal.ContextIndexSearcher searcher, org.elasticsearch.search.internal.ScrollContext scrollContext)
  • Method Details

    • setSearcher

      public void setSearcher(org.elasticsearch.search.internal.ContextIndexSearcher searcher)
    • preProcess

      public void preProcess(boolean rewrite)
      Specified by:
      preProcess in class org.elasticsearch.search.internal.SearchContext
    • buildFilteredQuery

      public org.apache.lucene.search.Query buildFilteredQuery(org.apache.lucene.search.Query query)
      Specified by:
      buildFilteredQuery in class org.elasticsearch.search.internal.SearchContext
    • id

      public org.elasticsearch.search.internal.ShardSearchContextId id()
      Specified by:
      id in class org.elasticsearch.search.internal.SearchContext
    • source

      public String source()
      Specified by:
      source in class org.elasticsearch.search.internal.SearchContext
    • request

      public org.elasticsearch.search.internal.ShardSearchRequest request()
      Specified by:
      request in class org.elasticsearch.search.internal.SearchContext
    • searchType

      public org.elasticsearch.action.search.SearchType searchType()
      Specified by:
      searchType in class org.elasticsearch.search.internal.SearchContext
    • shardTarget

      public org.elasticsearch.search.SearchShardTarget shardTarget()
      Specified by:
      shardTarget in class org.elasticsearch.search.internal.SearchContext
    • numberOfShards

      public int numberOfShards()
      Specified by:
      numberOfShards in class org.elasticsearch.search.internal.SearchContext
    • scrollContext

      public org.elasticsearch.search.internal.ScrollContext scrollContext()
      Specified by:
      scrollContext in class org.elasticsearch.search.internal.SearchContext
    • aggregations

      public org.elasticsearch.search.aggregations.SearchContextAggregations aggregations()
      Specified by:
      aggregations in class org.elasticsearch.search.internal.SearchContext
    • aggregations

      public org.elasticsearch.search.internal.SearchContext aggregations(org.elasticsearch.search.aggregations.SearchContextAggregations aggregations)
      Specified by:
      aggregations in class org.elasticsearch.search.internal.SearchContext
    • addSearchExt

      public void addSearchExt(org.elasticsearch.search.SearchExtBuilder searchExtBuilder)
      Specified by:
      addSearchExt in class org.elasticsearch.search.internal.SearchContext
    • getSearchExt

      public org.elasticsearch.search.SearchExtBuilder getSearchExt(String name)
      Specified by:
      getSearchExt in class org.elasticsearch.search.internal.SearchContext
    • highlight

      public org.elasticsearch.search.fetch.subphase.highlight.SearchHighlightContext highlight()
      Specified by:
      highlight in class org.elasticsearch.search.internal.SearchContext
    • highlight

      public void highlight(org.elasticsearch.search.fetch.subphase.highlight.SearchHighlightContext highlight)
      Specified by:
      highlight in class org.elasticsearch.search.internal.SearchContext
    • suggest

      public org.elasticsearch.search.suggest.SuggestionSearchContext suggest()
      Specified by:
      suggest in class org.elasticsearch.search.internal.SearchContext
    • suggest

      public void suggest(org.elasticsearch.search.suggest.SuggestionSearchContext suggest)
      Specified by:
      suggest in class org.elasticsearch.search.internal.SearchContext
    • rescore

      public List<org.elasticsearch.search.rescore.RescoreContext> rescore()
      Specified by:
      rescore in class org.elasticsearch.search.internal.SearchContext
    • hasScriptFields

      public boolean hasScriptFields()
      Specified by:
      hasScriptFields in class org.elasticsearch.search.internal.SearchContext
    • scriptFields

      public org.elasticsearch.search.fetch.subphase.ScriptFieldsContext scriptFields()
      Specified by:
      scriptFields in class org.elasticsearch.search.internal.SearchContext
    • sourceRequested

      public boolean sourceRequested()
      Specified by:
      sourceRequested in class org.elasticsearch.search.internal.SearchContext
    • hasFetchSourceContext

      public boolean hasFetchSourceContext()
      Specified by:
      hasFetchSourceContext in class org.elasticsearch.search.internal.SearchContext
    • fetchSourceContext

      public org.elasticsearch.search.fetch.subphase.FetchSourceContext fetchSourceContext()
      Specified by:
      fetchSourceContext in class org.elasticsearch.search.internal.SearchContext
    • fetchSourceContext

      public org.elasticsearch.search.internal.SearchContext fetchSourceContext(org.elasticsearch.search.fetch.subphase.FetchSourceContext fetchSourceContext)
      Specified by:
      fetchSourceContext in class org.elasticsearch.search.internal.SearchContext
    • docValuesContext

      public org.elasticsearch.search.fetch.subphase.FetchDocValuesContext docValuesContext()
      Specified by:
      docValuesContext in class org.elasticsearch.search.internal.SearchContext
    • docValuesContext

      public org.elasticsearch.search.internal.SearchContext docValuesContext(org.elasticsearch.search.fetch.subphase.FetchDocValuesContext docValuesContext)
      Specified by:
      docValuesContext in class org.elasticsearch.search.internal.SearchContext
    • fetchFieldsContext

      public org.elasticsearch.search.fetch.subphase.FetchFieldsContext fetchFieldsContext()
      Specified by:
      fetchFieldsContext in class org.elasticsearch.search.internal.SearchContext
    • fetchFieldsContext

      public org.elasticsearch.search.internal.SearchContext fetchFieldsContext(org.elasticsearch.search.fetch.subphase.FetchFieldsContext fetchFieldsContext)
      Specified by:
      fetchFieldsContext in class org.elasticsearch.search.internal.SearchContext
    • searcher

      public org.elasticsearch.search.internal.ContextIndexSearcher searcher()
      Specified by:
      searcher in class org.elasticsearch.search.internal.SearchContext
    • indexShard

      public org.elasticsearch.index.shard.IndexShard indexShard()
      Specified by:
      indexShard in class org.elasticsearch.search.internal.SearchContext
    • bitsetFilterCache

      public org.elasticsearch.index.cache.bitset.BitsetFilterCache bitsetFilterCache()
      Specified by:
      bitsetFilterCache in class org.elasticsearch.search.internal.SearchContext
    • timeout

      public org.elasticsearch.core.TimeValue timeout()
      Specified by:
      timeout in class org.elasticsearch.search.internal.SearchContext
    • timeout

      public void timeout(org.elasticsearch.core.TimeValue timeout)
      Specified by:
      timeout in class org.elasticsearch.search.internal.SearchContext
    • terminateAfter

      public int terminateAfter()
      Specified by:
      terminateAfter in class org.elasticsearch.search.internal.SearchContext
    • terminateAfter

      public void terminateAfter(int terminateAfter)
      Specified by:
      terminateAfter in class org.elasticsearch.search.internal.SearchContext
    • lowLevelCancellation

      public boolean lowLevelCancellation()
      Specified by:
      lowLevelCancellation in class org.elasticsearch.search.internal.SearchContext
    • minimumScore

      public org.elasticsearch.search.internal.SearchContext minimumScore(float minimumScore)
      Specified by:
      minimumScore in class org.elasticsearch.search.internal.SearchContext
    • minimumScore

      public Float minimumScore()
      Specified by:
      minimumScore in class org.elasticsearch.search.internal.SearchContext
    • sort

      public org.elasticsearch.search.internal.SearchContext sort(org.elasticsearch.search.sort.SortAndFormats sort)
      Specified by:
      sort in class org.elasticsearch.search.internal.SearchContext
    • sort

      public org.elasticsearch.search.sort.SortAndFormats sort()
      Specified by:
      sort in class org.elasticsearch.search.internal.SearchContext
    • trackScores

      public org.elasticsearch.search.internal.SearchContext trackScores(boolean trackScores)
      Specified by:
      trackScores in class org.elasticsearch.search.internal.SearchContext
    • trackScores

      public boolean trackScores()
      Specified by:
      trackScores in class org.elasticsearch.search.internal.SearchContext
    • trackTotalHitsUpTo

      public org.elasticsearch.search.internal.SearchContext trackTotalHitsUpTo(int trackTotalHitsUpTo)
      Specified by:
      trackTotalHitsUpTo in class org.elasticsearch.search.internal.SearchContext
    • trackTotalHitsUpTo

      public int trackTotalHitsUpTo()
      Specified by:
      trackTotalHitsUpTo in class org.elasticsearch.search.internal.SearchContext
    • searchAfter

      public org.elasticsearch.search.internal.SearchContext searchAfter(org.apache.lucene.search.FieldDoc searchAfter)
      Specified by:
      searchAfter in class org.elasticsearch.search.internal.SearchContext
    • searchAfter

      public org.apache.lucene.search.FieldDoc searchAfter()
      Specified by:
      searchAfter in class org.elasticsearch.search.internal.SearchContext
    • collapse

      public org.elasticsearch.search.internal.SearchContext collapse(org.elasticsearch.search.collapse.CollapseContext collapse)
      Specified by:
      collapse in class org.elasticsearch.search.internal.SearchContext
    • collapse

      public org.elasticsearch.search.collapse.CollapseContext collapse()
      Specified by:
      collapse in class org.elasticsearch.search.internal.SearchContext
    • parsedPostFilter

      public org.elasticsearch.search.internal.SearchContext parsedPostFilter(org.elasticsearch.index.query.ParsedQuery postFilter)
      Specified by:
      parsedPostFilter in class org.elasticsearch.search.internal.SearchContext
    • parsedPostFilter

      public org.elasticsearch.index.query.ParsedQuery parsedPostFilter()
      Specified by:
      parsedPostFilter in class org.elasticsearch.search.internal.SearchContext
    • parsedQuery

      public org.elasticsearch.search.internal.SearchContext parsedQuery(org.elasticsearch.index.query.ParsedQuery query)
      Specified by:
      parsedQuery in class org.elasticsearch.search.internal.SearchContext
    • parsedQuery

      public org.elasticsearch.index.query.ParsedQuery parsedQuery()
      Specified by:
      parsedQuery in class org.elasticsearch.search.internal.SearchContext
    • query

      public org.apache.lucene.search.Query query()
      Specified by:
      query in class org.elasticsearch.search.internal.SearchContext
    • from

      public int from()
      Specified by:
      from in class org.elasticsearch.search.internal.SearchContext
    • from

      public org.elasticsearch.search.internal.SearchContext from(int from)
      Specified by:
      from in class org.elasticsearch.search.internal.SearchContext
    • size

      public int size()
      Specified by:
      size in class org.elasticsearch.search.internal.SearchContext
    • setSize

      public void setSize(int size)
    • size

      public org.elasticsearch.search.internal.SearchContext size(int size)
      Specified by:
      size in class org.elasticsearch.search.internal.SearchContext
    • hasStoredFields

      public boolean hasStoredFields()
      Specified by:
      hasStoredFields in class org.elasticsearch.search.internal.SearchContext
    • storedFieldsContext

      public org.elasticsearch.search.fetch.StoredFieldsContext storedFieldsContext()
      Specified by:
      storedFieldsContext in class org.elasticsearch.search.internal.SearchContext
    • storedFieldsContext

      public org.elasticsearch.search.internal.SearchContext storedFieldsContext(org.elasticsearch.search.fetch.StoredFieldsContext storedFieldsContext)
      Specified by:
      storedFieldsContext in class org.elasticsearch.search.internal.SearchContext
    • explain

      public boolean explain()
      Specified by:
      explain in class org.elasticsearch.search.internal.SearchContext
    • explain

      public void explain(boolean explain)
      Specified by:
      explain in class org.elasticsearch.search.internal.SearchContext
    • groupStats

      public List<String> groupStats()
      Specified by:
      groupStats in class org.elasticsearch.search.internal.SearchContext
    • groupStats

      public void groupStats(List<String> groupStats)
      Specified by:
      groupStats in class org.elasticsearch.search.internal.SearchContext
    • version

      public boolean version()
      Specified by:
      version in class org.elasticsearch.search.internal.SearchContext
    • version

      public void version(boolean version)
      Specified by:
      version in class org.elasticsearch.search.internal.SearchContext
    • seqNoAndPrimaryTerm

      public boolean seqNoAndPrimaryTerm()
      Specified by:
      seqNoAndPrimaryTerm in class org.elasticsearch.search.internal.SearchContext
    • seqNoAndPrimaryTerm

      public void seqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm)
      Specified by:
      seqNoAndPrimaryTerm in class org.elasticsearch.search.internal.SearchContext
    • docIdsToLoad

      public int[] docIdsToLoad()
      Specified by:
      docIdsToLoad in class org.elasticsearch.search.internal.SearchContext
    • docIdsToLoadSize

      public int docIdsToLoadSize()
      Specified by:
      docIdsToLoadSize in class org.elasticsearch.search.internal.SearchContext
    • docIdsToLoad

      public org.elasticsearch.search.internal.SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadSize)
      Specified by:
      docIdsToLoad in class org.elasticsearch.search.internal.SearchContext
    • dfsResult

      public org.elasticsearch.search.dfs.DfsSearchResult dfsResult()
      Specified by:
      dfsResult in class org.elasticsearch.search.internal.SearchContext
    • queryResult

      public org.elasticsearch.search.query.QuerySearchResult queryResult()
      Specified by:
      queryResult in class org.elasticsearch.search.internal.SearchContext
    • fetchResult

      public org.elasticsearch.search.fetch.FetchSearchResult fetchResult()
      Specified by:
      fetchResult in class org.elasticsearch.search.internal.SearchContext
    • fetchPhase

      public org.elasticsearch.search.fetch.FetchPhase fetchPhase()
      Specified by:
      fetchPhase in class org.elasticsearch.search.internal.SearchContext
    • getRelativeTimeInMillis

      public long getRelativeTimeInMillis()
      Specified by:
      getRelativeTimeInMillis in class org.elasticsearch.search.internal.SearchContext
    • getProfilers

      public org.elasticsearch.search.profile.Profilers getProfilers()
      Specified by:
      getProfilers in class org.elasticsearch.search.internal.SearchContext
    • queryCollectors

      public Map<Class<?>,​org.apache.lucene.search.Collector> queryCollectors()
      Specified by:
      queryCollectors in class org.elasticsearch.search.internal.SearchContext
    • getSearchExecutionContext

      public org.elasticsearch.index.query.SearchExecutionContext getSearchExecutionContext()
      Specified by:
      getSearchExecutionContext in class org.elasticsearch.search.internal.SearchContext
    • setTask

      public void setTask(org.elasticsearch.action.search.SearchShardTask task)
      Specified by:
      setTask in class org.elasticsearch.search.internal.SearchContext
    • getTask

      public org.elasticsearch.action.search.SearchShardTask getTask()
      Specified by:
      getTask in class org.elasticsearch.search.internal.SearchContext
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in class org.elasticsearch.search.internal.SearchContext
    • addRescore

      public void addRescore(org.elasticsearch.search.rescore.RescoreContext rescore)
      Specified by:
      addRescore in class org.elasticsearch.search.internal.SearchContext
    • readerContext

      public org.elasticsearch.search.internal.ReaderContext readerContext()
      Specified by:
      readerContext in class org.elasticsearch.search.internal.SearchContext