public abstract class BaseInnerHitBuilder<T extends BaseInnerHitBuilder> extends Object implements ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected SearchSourceBuilder |
sourceBuilder |
EMPTY_PARAMS
Constructor and Description |
---|
BaseInnerHitBuilder() |
Modifier and Type | Method and Description |
---|---|
T |
addFieldDataField(String name)
Adds a field data based field to load and return.
|
T |
addHighlightedField(HighlightBuilder.Field field)
Adds a highlighted field.
|
T |
addHighlightedField(String name)
Adds a field to be highlighted with default fragment size of 100 characters, and
default number of fragments of 5.
|
T |
addHighlightedField(String name,
int fragmentSize)
Adds a field to be highlighted with a provided fragment size (in characters), and
default number of fragments of 5.
|
T |
addHighlightedField(String name,
int fragmentSize,
int numberOfFragments)
Adds a field to be highlighted with a provided fragment size (in characters), and
a provided (maximum) number of fragments.
|
T |
addHighlightedField(String name,
int fragmentSize,
int numberOfFragments,
int fragmentOffset)
Adds a field to be highlighted with a provided fragment size (in characters),
a provided (maximum) number of fragments and an offset for the highlight.
|
T |
addScriptField(String name,
Script script)
Adds a script based field to load and return.
|
T |
addSort(SortBuilder sort)
Adds a generic sort builder.
|
T |
addSort(String field,
SortOrder order)
Adds a sort against the given field name and the sort ordering.
|
T |
field(String name)
Add a stored field to be loaded and returned with the inner hit.
|
HighlightBuilder |
highlightBuilder() |
T |
setExplain(boolean explain)
Should each
SearchHit be returned with an
explanation of the hit (ranking). |
T |
setFetchSource(boolean fetch)
Indicates whether the response should contain the stored _source for every hit
|
T |
setFetchSource(String[] includes,
String[] excludes)
Indicate that _source should be returned with every hit, with an "include" and/or "exclude" set which can include simple wildcard
elements.
|
T |
setFetchSource(String include,
String exclude)
Indicate that _source should be returned with every hit, with an "include" and/or "exclude" set which can include simple wildcard
elements.
|
T |
setFrom(int from)
The index to start to return hits from.
|
T |
setHighlighterBoundaryChars(char[] boundaryChars) |
T |
setHighlighterBoundaryMaxScan(Integer boundaryMaxScan) |
T |
setHighlighterEncoder(String encoder)
The encoder to set for highlighting
|
T |
setHighlighterFilter(Boolean highlightFilter) |
T |
setHighlighterFragmenter(String fragmenter) |
T |
setHighlighterFragmentSize(Integer fragmentSize) |
T |
setHighlighterNoMatchSize(Integer noMatchSize)
Sets the size of the fragment to return from the beginning of the field if there are no matches to
highlight and the field doesn't also define noMatchSize.
|
T |
setHighlighterNumOfFragments(Integer numOfFragments) |
T |
setHighlighterOptions(Map<String,Object> options) |
T |
setHighlighterOrder(String order)
The order of fragments per field.
|
T |
setHighlighterPhraseLimit(Integer phraseLimit)
Sets the maximum number of phrases the fvh will consider if the field doesn't also define phraseLimit.
|
T |
setHighlighterPostTags(String... postTags)
Explicitly set the post tags that will be used for highlighting.
|
T |
setHighlighterPreTags(String... preTags)
Explicitly set the pre tags that will be used for highlighting.
|
T |
setHighlighterQuery(QueryBuilder highlightQuery)
Sets a query to be used for highlighting all fields instead of the search query.
|
T |
setHighlighterRequireFieldMatch(boolean requireFieldMatch) |
T |
setHighlighterTagsSchema(String schemaName)
Set a tag scheme that encapsulates a built in pre and post tags.
|
T |
setHighlighterType(String type)
The highlighter type to use.
|
T |
setNoFields()
Sets no fields to be loaded, resulting in only id and type to be returned per field.
|
T |
setSize(int size)
The number of search hits to return.
|
T |
setTrackScores(boolean trackScores)
Applies when sorting, and controls if scores will be tracked as well.
|
T |
setVersion(boolean version)
Should each
SearchHit be returned with its
version. |
protected SearchSourceBuilder |
sourceBuilder() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
protected SearchSourceBuilder sourceBuilder
public T setFrom(int from)
public T setSize(int size)
public T setTrackScores(boolean trackScores)
public T setExplain(boolean explain)
SearchHit
be returned with an
explanation of the hit (ranking).public T setNoFields()
public T setFetchSource(boolean fetch)
public T setFetchSource(@Nullable String include, @Nullable String exclude)
include
- An optional include (optionally wildcarded) pattern to filter the returned _sourceexclude
- An optional exclude (optionally wildcarded) pattern to filter the returned _sourcepublic T setFetchSource(@Nullable String[] includes, @Nullable String[] excludes)
includes
- An optional list of include (optionally wildcarded) pattern to filter the returned _sourceexcludes
- An optional list of exclude (optionally wildcarded) pattern to filter the returned _sourcepublic T addFieldDataField(String name)
name
- The field to get from the field data cachepublic T addScriptField(String name, Script script)
name
- The name that will represent this value in the return hitscript
- The script to usepublic T addSort(String field, SortOrder order)
field
- The name of the fieldorder
- The sort orderingpublic T addSort(SortBuilder sort)
SortBuilders
public HighlightBuilder highlightBuilder()
public T addHighlightedField(String name)
name
- The field to highlightpublic T addHighlightedField(String name, int fragmentSize)
name
- The field to highlightfragmentSize
- The size of a fragment in characterspublic T addHighlightedField(String name, int fragmentSize, int numberOfFragments)
name
- The field to highlightfragmentSize
- The size of a fragment in charactersnumberOfFragments
- The (maximum) number of fragmentspublic T addHighlightedField(String name, int fragmentSize, int numberOfFragments, int fragmentOffset)
name
- The field to highlightfragmentSize
- The size of a fragment in charactersnumberOfFragments
- The (maximum) number of fragmentspublic T addHighlightedField(HighlightBuilder.Field field)
public T setHighlighterTagsSchema(String schemaName)
schemaName
- The tag scheme namepublic T setHighlighterEncoder(String encoder)
public T setHighlighterPreTags(String... preTags)
public T setHighlighterPostTags(String... postTags)
public T setHighlighterOrder(String order)
public T setHighlighterRequireFieldMatch(boolean requireFieldMatch)
public T setHighlighterBoundaryChars(char[] boundaryChars)
public T setHighlighterQuery(QueryBuilder highlightQuery)
public T setHighlighterNoMatchSize(Integer noMatchSize)
noMatchSize
- integer to set or null to leave out of request. default is null.public T setHighlighterPhraseLimit(Integer phraseLimit)
protected SearchSourceBuilder sourceBuilder()
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
Copyright © 2009–2016. All rights reserved.