|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.search.builder.SearchSourceBuilder
public class SearchSourceBuilder
A search source builder allowing to easily build search source. Simple construction
using searchSource()
.
SearchRequest.source(SearchSourceBuilder)
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
ToXContent.MapParams, ToXContent.Params |
Field Summary |
---|
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
EMPTY_PARAMS |
Constructor Summary | |
---|---|
SearchSourceBuilder()
Constructs a new search source builder. |
Method Summary | |
---|---|
BytesReference |
buildAsBytes()
|
BytesReference |
buildAsBytes(XContentType contentType)
|
SearchSourceBuilder |
explain(Boolean explain)
Should each SearchHit be returned with an
explanation of the hit (ranking). |
SearchSourceBuilder |
facet(AbstractFacetBuilder facet)
Add a facet to perform as part of the search. |
SearchSourceBuilder |
facets(byte[] facetsBinary)
Sets a raw (xcontent / json) facets. |
SearchSourceBuilder |
facets(byte[] facetsBinary,
int facetBinaryOffset,
int facetBinaryLength)
Sets a raw (xcontent / json) facets. |
SearchSourceBuilder |
facets(BytesReference facetsBinary)
Sets a raw (xcontent / json) facets. |
SearchSourceBuilder |
facets(Map facets)
Sets a raw (xcontent / json) facets. |
SearchSourceBuilder |
facets(XContentBuilder facets)
Sets a raw (xcontent / json) facets. |
SearchSourceBuilder |
field(String name)
Adds a field to load and return (note, it must be stored) as part of the search request. |
SearchSourceBuilder |
fields(List<String> fields)
Sets the fields to load and return as part of the search request. |
SearchSourceBuilder |
fields(String... fields)
Adds the fields to load and return as part of the search request. |
SearchSourceBuilder |
filter(byte[] filter)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchSourceBuilder |
filter(byte[] filterBinary,
int filterBinaryOffset,
int filterBinaryLength)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchSourceBuilder |
filter(BytesReference filterBinary)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchSourceBuilder |
filter(FilterBuilder filter)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchSourceBuilder |
filter(Map filter)
Constructs a new search source builder with a query from a map. |
SearchSourceBuilder |
filter(String filterString)
Sets a filter on the query executed that only applies to the search query (and not facets for example). |
SearchSourceBuilder |
filter(XContentBuilder filter)
Constructs a new search source builder with a query from a builder. |
SearchSourceBuilder |
from(int from)
From index to start the search from. |
static HighlightBuilder |
highlight()
A static factory method to construct new search highlights. |
SearchSourceBuilder |
highlight(HighlightBuilder highlightBuilder)
Adds highlight to perform as part of the search. |
HighlightBuilder |
highlighter()
|
SearchSourceBuilder |
indexBoost(String index,
float indexBoost)
Sets the boost a specific index will receive when the query is executeed against it. |
SearchSourceBuilder |
minScore(float minScore)
Sets the minimum score below which docs will be filtered out. |
SearchSourceBuilder |
noFields()
Sets no fields to be loaded, resulting in only id and type to be returned per field. |
SearchSourceBuilder |
partialField(String name,
String[] includes,
String[] excludes)
Adds a partial field based on _source, with an "includes" and/or "excludes set which can include simple wildcard elements. |
SearchSourceBuilder |
partialField(String name,
String include,
String exclude)
Adds a partial field based on _source, with an "include" and/or "exclude" set which can include simple wildcard elements. |
SearchSourceBuilder |
query(byte[] queryBinary)
Constructs a new search source builder with a raw search query. |
SearchSourceBuilder |
query(byte[] queryBinary,
int queryBinaryOffset,
int queryBinaryLength)
Constructs a new search source builder with a raw search query. |
SearchSourceBuilder |
query(BytesReference queryBinary)
Constructs a new search source builder with a raw search query. |
SearchSourceBuilder |
query(Map query)
Constructs a new search source builder with a query from a map. |
SearchSourceBuilder |
query(QueryBuilder query)
Constructs a new search source builder with a search query. |
SearchSourceBuilder |
query(String queryString)
Constructs a new search source builder with a raw search query. |
SearchSourceBuilder |
query(XContentBuilder query)
Constructs a new search source builder with a query from a builder. |
SearchSourceBuilder |
scriptField(String name,
String script)
Adds a script field under the given name with the provided script. |
SearchSourceBuilder |
scriptField(String name,
String script,
Map<String,Object> params)
Adds a script field. |
SearchSourceBuilder |
scriptField(String name,
String lang,
String script,
Map<String,Object> params)
Adds a script field. |
static SearchSourceBuilder |
searchSource()
A static factory method to construct a new search source. |
SearchSourceBuilder |
size(int size)
The number of search hits to return. |
SearchSourceBuilder |
sort(SortBuilder sort)
Adds a sort builder. |
SearchSourceBuilder |
sort(String name)
Add a sort against the given field name. |
SearchSourceBuilder |
sort(String name,
SortOrder order)
Adds a sort against the given field name and the sort ordering. |
SearchSourceBuilder |
stats(String... statsGroups)
The stats groups this request will be aggregated under. |
SearchSourceBuilder |
timeout(String timeout)
An optional timeout to control how long search is allowed to take. |
SearchSourceBuilder |
timeout(TimeValue timeout)
An optional timeout to control how long search is allowed to take. |
String |
toString()
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params)
|
SearchSourceBuilder |
trackScores(boolean trackScores)
Applies when sorting, and controls if scores will be tracked as well. |
SearchSourceBuilder |
version(Boolean version)
Should each SearchHit be returned with a version
associated with it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SearchSourceBuilder()
Method Detail |
---|
public static SearchSourceBuilder searchSource()
public static HighlightBuilder highlight()
public SearchSourceBuilder query(QueryBuilder query)
QueryBuilders
public SearchSourceBuilder query(byte[] queryBinary)
public SearchSourceBuilder query(byte[] queryBinary, int queryBinaryOffset, int queryBinaryLength)
public SearchSourceBuilder query(BytesReference queryBinary)
public SearchSourceBuilder query(String queryString)
public SearchSourceBuilder query(XContentBuilder query)
public SearchSourceBuilder query(Map query)
public SearchSourceBuilder filter(FilterBuilder filter)
public SearchSourceBuilder filter(String filterString)
public SearchSourceBuilder filter(byte[] filter)
public SearchSourceBuilder filter(byte[] filterBinary, int filterBinaryOffset, int filterBinaryLength)
public SearchSourceBuilder filter(BytesReference filterBinary)
public SearchSourceBuilder filter(XContentBuilder filter)
public SearchSourceBuilder filter(Map filter)
public SearchSourceBuilder from(int from)
public SearchSourceBuilder size(int size)
public SearchSourceBuilder minScore(float minScore)
public SearchSourceBuilder explain(Boolean explain)
SearchHit
be returned with an
explanation of the hit (ranking).
public SearchSourceBuilder version(Boolean version)
SearchHit
be returned with a version
associated with it.
public SearchSourceBuilder timeout(TimeValue timeout)
public SearchSourceBuilder timeout(String timeout)
public SearchSourceBuilder sort(String name, SortOrder order)
name
- The name of the fieldorder
- The sort orderingpublic SearchSourceBuilder sort(String name)
name
- The name of the field to sort bypublic SearchSourceBuilder sort(SortBuilder sort)
public SearchSourceBuilder trackScores(boolean trackScores)
public SearchSourceBuilder facet(AbstractFacetBuilder facet)
public SearchSourceBuilder facets(byte[] facetsBinary)
public SearchSourceBuilder facets(byte[] facetsBinary, int facetBinaryOffset, int facetBinaryLength)
public SearchSourceBuilder facets(BytesReference facetsBinary)
public SearchSourceBuilder facets(XContentBuilder facets)
public SearchSourceBuilder facets(Map facets)
public HighlightBuilder highlighter()
public SearchSourceBuilder highlight(HighlightBuilder highlightBuilder)
public SearchSourceBuilder noFields()
public SearchSourceBuilder fields(List<String> fields)
public SearchSourceBuilder fields(String... fields)
public SearchSourceBuilder field(String name)
public SearchSourceBuilder scriptField(String name, String script)
name
- The name of the fieldscript
- The scriptpublic SearchSourceBuilder scriptField(String name, String script, Map<String,Object> params)
name
- The name of the fieldscript
- The script to executeparams
- The script parameterspublic SearchSourceBuilder scriptField(String name, String lang, String script, Map<String,Object> params)
name
- The name of the fieldlang
- The language of the scriptscript
- The script to executeparams
- The script parameters (can be null)
public SearchSourceBuilder partialField(String name, @Nullable String include, @Nullable String exclude)
name
- The name of the fieldinclude
- An optional include (optionally wildcarded) pattern from _sourceexclude
- An optional exclude (optionally wildcarded) pattern from _sourcepublic SearchSourceBuilder partialField(String name, @Nullable String[] includes, @Nullable String[] excludes)
name
- The name of the fieldincludes
- An optional list of includes (optionally wildcarded) patterns from _sourceexcludes
- An optional list of excludes (optionally wildcarded) patterns from _sourcepublic SearchSourceBuilder indexBoost(String index, float indexBoost)
index
- The index to apply the boost againstindexBoost
- The boost to apply to the indexpublic SearchSourceBuilder stats(String... statsGroups)
public String toString()
toString
in class Object
public BytesReference buildAsBytes() throws SearchSourceBuilderException
SearchSourceBuilderException
public BytesReference buildAsBytes(XContentType contentType) throws SearchSourceBuilderException
SearchSourceBuilderException
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
toXContent
in interface ToXContent
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |