- Docs
- Cloaked Search
- Usage
- Querying
- Term
Term Query
Returns documents that contain an exact term in a provided field.
You can use the term
query to find documents based on a precise value such as a price, a product ID, or a username.
Warning: Avoid using the
term
query for text fields. By default, Cloaked Search changes the values of text fields as part of analysis. This can make finding exact matches for text field values difficult. To search text field values, use thematch
query instead.
Parameters
field
(Required, object) Field you wish to search. You can simplify the term query syntax by combining the field and value parameters.
value
(Required, string) Term you wish to find in the provided field. To return a document, the term must exactly match the field value, including whitespace and capitalization.
boost
(Optional, float) Floating point number used to decrease or increase the relevance scores of a query. Defaults to
1.0
.You can use the boost parameter to adjust relevance scores for searches containing two or more queries.
Boost values are relative to the default value of
1.0
. A boost value between0
and1.0
decreases the relevance score. A value greater than1.0
increases the relevance score.
Example
JSON{ "query": { "term": { "user.id": { "value": "12345", "boost": 1.0 } } } }