java.lang.Object
org.elasticsearch.search.retriever.RetrieverBuilder
- All Implemented Interfaces:
ToXContent
- Direct Known Subclasses:
KnnRetrieverBuilder
,StandardRetrieverBuilder
A retriever represents an API element that returns an ordered list of top
documents. These can be obtained from a query, from another retriever, etc.
Internally, a
RetrieverBuilder
is just a wrapper for other search
elements that are extracted into a SearchSourceBuilder
. The advantage
retrievers have is in the API they appear as a tree-like structure enabling
easier reasoning about what a search does.
This is the base class for all other retrievers. This class does not support
serialization and is expected to be fully extracted to a SearchSourceBuilder
prior to any transport calls.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ParseField
protected List<QueryBuilder>
static final NodeFeature
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
declareBaseParserFields
(String name, AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser) protected abstract boolean
protected abstract int
protected abstract void
doToXContent
(XContentBuilder builder, ToXContent.Params params) final boolean
abstract void
extractToSearchSourceBuilder
(SearchSourceBuilder searchSourceBuilder, boolean compoundUsed) This method is called at the end of parsing on behalf of aSearchSourceBuilder
.abstract String
getName()
Gets the filters for this retriever.final int
hashCode()
boolean
protected static RetrieverBuilder
parseInnerRetrieverBuilder
(XContentParser parser, RetrieverParserContext context) static RetrieverBuilder
parseTopLevelRetrieverBuilder
(XContentParser parser, RetrieverParserContext context) This method parsers a top-level retriever within a search and tracks its own depth.toString()
final XContentBuilder
toXContent
(XContentBuilder builder, ToXContent.Params params)
-
Field Details
-
RETRIEVERS_SUPPORTED
-
PRE_FILTER_FIELD
-
preFilterQueryBuilders
-
-
Constructor Details
-
RetrieverBuilder
public RetrieverBuilder()
-
-
Method Details
-
declareBaseParserFields
protected static void declareBaseParserFields(String name, AbstractObjectParser<? extends RetrieverBuilder, RetrieverParserContext> parser) -
parseTopLevelRetrieverBuilder
public static RetrieverBuilder parseTopLevelRetrieverBuilder(XContentParser parser, RetrieverParserContext context) throws IOException This method parsers a top-level retriever within a search and tracks its own depth. Currently, the maximum depth allowed is limited to 2 as a compound retriever cannot currently contain another compound retriever.- Throws:
IOException
-
parseInnerRetrieverBuilder
protected static RetrieverBuilder parseInnerRetrieverBuilder(XContentParser parser, RetrieverParserContext context) throws IOException - Throws:
IOException
-
getPreFilterQueryBuilders
Gets the filters for this retriever. -
extractToSearchSourceBuilder
public abstract void extractToSearchSourceBuilder(SearchSourceBuilder searchSourceBuilder, boolean compoundUsed) This method is called at the end of parsing on behalf of aSearchSourceBuilder
. Elements from retrievers are expected to be "extracted" into theSearchSourceBuilder
. -
getName
-
toXContent
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
doToXContent
protected abstract void doToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Throws:
IOException
-
isFragment
public boolean isFragment()- Specified by:
isFragment
in interfaceToXContent
-
equals
-
doEquals
-
hashCode
public final int hashCode() -
doHashCode
protected abstract int doHashCode() -
toString
-