Interface SearchStrategy

All Known Implementing Classes:
AbstractSearchStrategy, AllTermsAnyFieldSearchStrategy, AllTermsSingleFieldSearchStrategy, AnyTermAnyFieldSearchStrategy, PhraseSearchStrategy

public interface SearchStrategy
Describes the way search context should be processed.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configureRequest(org.elasticsearch.action.search.SearchRequest searchRequest, SearchContext searchContext)
    Configures Elasticsearch SearchRequest.
    Provides the name of this search strategy.
  • Method Details

    • getName

      String getName()
      Provides the name of this search strategy. Name should be unique among all search strategies in application.
      Returns:
      name
    • configureRequest

      void configureRequest(org.elasticsearch.action.search.SearchRequest searchRequest, SearchContext searchContext)
      Configures Elasticsearch SearchRequest.

      The main step - create appropriate query based on provided SearchContext and set it to request.

      Configuration of another request parameters is optional. Custom highlighting can be configured here. If it wasn't - the default one will be used.

      Size and offset shouldn't be configured here - these parameters will be overwritten.

      Parameters:
      searchRequest - Elasticsearch SearchRequest
      searchContext - SearchContext