Term-Level Queries
Term-level queries find documents that contain exact terms. These queries are not analyzed and match the exact value stored in the field.
Term Query
Returns documents that contain an exact term in a provided field. Use for precise matching on keyword, numeric, date, or boolean fields. The term query is not analyzed, so it searches for the exact value as stored.
Request:
{
"query": {
"term": {
"status": "published"
}
}
}
Response:
{
"took": 2,
"hits": {
"total": {"value": 150},
"hits": [
{
"_id": "1",
"_source": {
"title": "Getting Started Guide",
"status": "published",
"author": "admin"
}
}
]
}
}
Advanced term query with options:
{
"query": {
"term": {
"status": {
"value": "published",
"case_insensitive": true
}
}
}
}
Supported parameters:
value- The exact term to search forcase_insensitive- Whether to ignore case (boolean)boost- ⚠️ Accepted but ignored in Infino
Terms Query
Returns documents that contain one or more exact terms in a provided field. Equivalent to multiple term queries combined with OR logic. Useful for filtering by multiple specific values.
{
"query": {
"terms": {
"status": ["published", "draft", "pending"]
}
}
}
Range Query
Returns documents with field values within a specified range. Works with numeric, date, or string fields. Use comparison operators to define boundaries.
{
"query": {
"range": {
"age": {
"gte": 18,
"lte": 65
}
}
}
}
Range operators:
gte- Greater than or equal togt- Greater thanlte- Less than or equal tolt- Less thanfrom/to- Alternative syntax for range bounds
Date ranges:
{
"query": {
"range": {
"@timestamp": {
"gte": "2024-01-01T00:00:00Z",
"lte": "2024-12-31T23:59:59Z",
"format": "yyyy-MM-dd'T'HH:mm:ss'Z'",
"time_zone": "UTC"
}
}
}
}
Exists Query
Returns documents that contain an indexed value for a field. A field is considered to exist if it has any non-null value, including empty strings and arrays.
{
"query": {
"exists": {
"field": "user.email"
}
}
}
Prefix Query
Returns documents that contain terms beginning with an exact prefix. Useful for autocomplete scenarios or finding terms with common prefixes.
{
"query": {
"prefix": {
"message": "error"
}
}
}
Wildcard Query
Returns documents that contain terms matching a wildcard pattern. Use * to match any sequence of characters and ? to match any single character.
{
"query": {
"wildcard": {
"filename": "*.log"
}
}
}