Class SearchApiResponse<T extends ResponseDocument>
- java.lang.Object
-
- co.elasticsearch.enterprisesearch.client.model.response.search.SearchApiResponse<T>
-
- Type Parameters:
T- The type of document contained in the given engine
- All Implemented Interfaces:
ErrorableResponse,Iterable<T>
public class SearchApiResponse<T extends ResponseDocument> extends Object implements Iterable<T>, ErrorableResponse
Represents the response from a search operation
-
-
Constructor Summary
Constructors Constructor Description SearchApiResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)voidforEach(Consumer<? super T> action)List<String>getErrors()The errors associated with this response, if any<F extends Facet>
Optional<F>getFacetByFieldAndName(String fieldName, String facetName, Class<F> facetType)Get the Facet on the specified field, with the specified name, and type.<F extends Facet>
Optional<F>getFacetByName(String facetName, Class<F> facetType)Get the Facet on the specified field, with the specified name, and type.List<Facet>getFacets()Get the facetsList<Facet>getFacetsByField(String fieldName)Get a list of Facets that are mapped to a specific fieldMetagetMeta()Object delimiting the results meta data.List<T>getResults()The documents returned by the requestinthashCode()booleanisAlert()Returns if there is 1 or more alerts for this responsebooleanisError()Gets whether this response contains any errors from the requested operationbooleanisWarning()Returns if there is 1 or more warnings for this responseIterator<T>iterator()SearchApiResponse<T>setErrors(List<String> errors)The errors associated with this response, if anySearchApiResponse<T>setFacetMap(Map<String,List<Facet>> facetMap)Value and Range facets for the querySearchApiResponse<T>setMeta(Meta meta)Object delimiting the results meta data.SearchApiResponse<T>setResults(List<T> results)The documents returned by the requestSpliterator<T>spliterator()StringtoString()
-
-
-
Method Detail
-
getFacetsByField
public List<Facet> getFacetsByField(String fieldName)
Get a list of Facets that are mapped to a specific field- Parameters:
fieldName- The name of the field in the search document- Returns:
- A list of facets
-
getFacetByName
public <F extends Facet> Optional<F> getFacetByName(String facetName, Class<F> facetType)
Get the Facet on the specified field, with the specified name, and type. The facet- Type Parameters:
F- The type of facet expected. If the type does not match, it will return an empty Optional- Parameters:
facetName- The name of the facetfacetType- the type of the facet- Returns:
- The facet if one is found, and is the correct class, or an empty Optional
-
getFacetByFieldAndName
public <F extends Facet> Optional<F> getFacetByFieldAndName(String fieldName, String facetName, Class<F> facetType)
Get the Facet on the specified field, with the specified name, and type. The facet- Type Parameters:
F- The type of facet expected. If the type does not match, it will return an empty Optional- Parameters:
fieldName- The name of the field in the search documentfacetName- The name of the facetfacetType- The type of the facet- Returns:
- The facet if one is found, and is the correct class, or an empty Optional
-
iterator
@NotNull public Iterator<T> iterator()
- Specified by:
iteratorin interfaceIterable<T extends ResponseDocument>
-
forEach
public void forEach(Consumer<? super T> action)
- Specified by:
forEachin interfaceIterable<T extends ResponseDocument>
-
spliterator
public Spliterator<T> spliterator()
- Specified by:
spliteratorin interfaceIterable<T extends ResponseDocument>
-
isWarning
public boolean isWarning()
Returns if there is 1 or more warnings for this response- Returns:
- true if there is at least 1 warning, otherwise false
-
isAlert
public boolean isAlert()
Returns if there is 1 or more alerts for this response- Returns:
- true if there is at least 1 alert, otherwise false
-
isError
public boolean isError()
Description copied from interface:ErrorableResponseGets whether this response contains any errors from the requested operation- Specified by:
isErrorin interfaceErrorableResponse- Returns:
- true if 1 or more errors occurred, otherwise false
-
getMeta
public Meta getMeta()
Object delimiting the results meta data.- Returns:
- the page metadata
-
getErrors
public List<String> getErrors()
The errors associated with this response, if any- Returns:
- the errors
-
setMeta
public SearchApiResponse<T> setMeta(Meta meta)
Object delimiting the results meta data.- Parameters:
meta- the page metadata- Returns:
this.
-
setResults
public SearchApiResponse<T> setResults(List<T> results)
The documents returned by the request- Parameters:
results- the results- Returns:
this.
-
setErrors
public SearchApiResponse<T> setErrors(List<String> errors)
The errors associated with this response, if any- Parameters:
errors- the errors- Returns:
this.
-
setFacetMap
public SearchApiResponse<T> setFacetMap(Map<String,List<Facet>> facetMap)
Value and Range facets for the query- Parameters:
facetMap- The facets to build on the search results- Returns:
this.
-
canEqual
protected boolean canEqual(Object other)
-
-