Constructor
new SearchRequest(…indices)
Initializes the SearchRequest for the given indices.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
indices |
string |
<repeatable> |
- Source:
Methods
addExclude(…exclude) → {SearchRequest}
Add a field or array of fields to the list of excluded result fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
exclude |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addFacet(…field) → {SearchRequest}
Adds the given field as facet to be calculated for the
search response.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
field |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addInclude(…include) → {SearchRequest}
Add a field or array of fields to the list of included result fields.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
include |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addQuery(query) → {SearchRequest}
Adds the given query string to the request.
Parameters:
Name | Type | Description |
---|---|---|
query |
string |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addQueryFacet(field, …value) → {SearchRequest}
Adds the given field/value pair as facet restriction to the query.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
field |
string | ||
value |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addQueryGeometry(field, …value) → {SearchRequest}
Adds the given field/value pair as geometry restriction to the query.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
field |
string | ||
value |
string |
<repeatable> |
value |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addRange(field, from, to, includeFrom, includeTo) → {SearchRequest}
Adds a from/to range for the given field to the query.
And sets bounds as given by includeFrom and includeTo.
includeFrom and includeTo are optional and true by default.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
field |
string | ||
from |
string | ||
to |
string | ||
includeFrom |
boolean | true | |
includeTo |
boolean | true |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addSort(field, asc) → {SearchRequest}
Adds a sort defined by the field and order asc}.
If asc is not defined sort will be executed asc.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
field |
string | ||
asc |
boolean | true |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addTerm(field, …value) → {SearchRequest}
Adds the given term query defined by field and value to the request.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
field |
string | ||
value |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
addType(…type) → {SearchRequest}
Adds the given type for the search.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
and(…requests) → {SearchRequest}
Wraps the given SearchRequests in an AND and adds it to the request.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
requests |
SearchRequest |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
not() → {SearchRequest}
Adds a NOT the the query.
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
or(…requests) → {SearchRequest}
Wraps the given SearchRequests in an OR and adds it to the request.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
requests |
SearchRequest |
<repeatable> |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
setHits(hits) → {SearchRequest}
Sets the maximum number of hits to be returned by the search result.
Parameters:
Name | Type | Description |
---|---|---|
hits |
number |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest
setOffset(offset) → {SearchRequest}
Sets the scrolling offset of returned search results.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number |
- Source:
Returns:
instance of SearchRequest for chaining
- Type
- SearchRequest