Skip to main content

Fields API

These endpoints describe stored data for field lists and completion. Any valid key can call them when authentication is on. Like a query, each one first writes the events ingested so far.

GET /fields​

Lists the fields the indexes hold, each with the indexes that hold it, sorted by name.

ParameterDescription
index (or source)Only this index
prefixOnly fields whose name starts with this prefix
curl -s 'localhost:3100/api/v1/fields?prefix=st'
{"data": {"fields": [{"name": "status", "indexes": ["backend", "main"]}]}}
FieldDescription
nameField name. The members of a nested object are listed by their path, such as order.id
indexesThe indexes that hold the field, sorted by name

The list includes _time, and _raw and the ingest labels (source, sourcetype, host) where events carry them. An unknown index gives an empty list.

GET /fields/{name}/values​

Returns the most frequent values of one field among the events that hold it, with their counts, the most frequent first.

ParameterDefaultDescription
limit10Values to return, at most 100
indexall indexesOnly this index
fromStart of the time range: relative (-1h) or absolute
sinceStart of the time range as a span back from now (1h); from wins when both are set
toEnd of the time range
curl -s 'localhost:3100/api/v1/fields/level/values?limit=3'
{
"data": {
"field": "level",
"values": [
{"value": "INFO", "count": 374},
{"value": "WARN", "count": 353},
{"value": "ERROR", "count": 299}
]
},
"meta": {"took_ms": 0.314}
}

Each value keeps its type, so a numeric field returns numbers. An unknown field returns an empty values list. A field name or index that holds a backtick or a line break, or an unparsable time, answers 400 VALIDATION_ERROR.

To compute the same breakdown with filters, run a query such as source=main status>=500 | top 10 path.