Skip to main content

Search REST API

API version#

All the API endpoints start with the api/v1/ prefix. v1 indicates that we are currently using version 1 of the API.

Format#

The API uses JSON encoded as UTF-8. The body of POST and PUT requests must be a JSON object and their Content-Type header should be set to application/json; charset=UTF-8.

The body of responses is always a JSON object, and their content type is always application/json; charset=UTF-8.

Parameters#

Parameters passed in the URL must be properly URL-encoded, using the UTF-8 encoding for non-ASCII characters.

GET [..]/search?query=barack%20obama

Error handling#

Successful requests return a 2xx HTTP status code.

Failed requests return a 4xx HTTP status code. The response body of failed requests holds a JSON object containing an error_message field that describes the error.

{
"error_message": "Failed to parse query"
}

Endpoints#

Search in an index#

GET api/v1/indexes/<index name>/search

Search for documents matching a query in the given index <index name>.

Path variable#

VariableDescription
index nameThe index name

Get parameters#

VariableTypeDescriptionDefault value
queryStringQuery text. See the query language doc (mandatory)
startTimestampi64If set, restrict search to documents with a timestamp >= start_timestamp
endTimestampi64If set, restrict search to documents with a `timestamp < end_timestamp``
startOffsetIntegerNumber of documents to skip0
maxHitsIntegerMaximum number of hits to return (by default 20)20

Response#

fieldDescriptiontype
hitsResults of the query[hit]
numHitsTotal number of matchesnumber
numMicrosecsProcessing time of the querynumber