Terms query #
Returns documents that contain one or more exact terms in a provided
field. Equivalent to a boolean should of individual
term queries — a document matches if it contains any
of the values.
Inside a
nestedquery: not supported yet — the clause is rejected with an HTTP 400 naming the offending clause. Expand into aboolshouldoftermclauses instead.
Examples #
POST /my-collection/_search
{
"query": {
"terms": {
"field": "status",
"values": ["published", "pending"]
}
}
}
Parameters for terms
#
field
(Required, string) The field to match.values
(Required, array) List of terms to match. A document matches if it contains any of these values.boost
(Optional, float, default:1.0) Decrease or increase the relevance scores of the query.
Notes #
The values are matched as exact terms — no analysis is applied. To
match analyzed text, use the
match query.