For AI agents: this page is also available as Markdown at /docs/searching.md. Every docs page is: add .md to its URL. llms.txt lists them all.

Searching

A search is one POST /v1/search/{collection}: a query in the language of your choice (search-box text unless you say otherwise), plus optional filters, sorting, paging and the fields to return. WarpSearch runs it over one consistent view of the collection and returns ranked hits, with any facets and metrics you asked for, in one response. Existing Elasticsearch, OpenSearch and Solr clients can search through their compatible endpoints instead, as the other tabs show.

The languages query can be written in are described in Query languages, analytics in Facets and aggregations, and vectors in Vector search and Hybrid search.

curl -X POST https://api.warpsearch.io/v1/search/books \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "dune",
    "filters": ["year:[1960 TO 1980]", "genre:scifi"],
    "sort": ["year desc"],
    "fields": ["title", "year"],
    "limit": 10
  }'
{
  "took_ms": 3,
  "collection": "books",
  "total": 2,
  "offset": 0,
  "hits": [
    {"id": "b2", "fields": {"title": "Dune Messiah", "year": 1969}},
    {"id": "b1", "fields": {"title": "Dune", "year": 1965}}
  ]
}

The same search as an Elasticsearch _search request, answered in Elasticsearch's response shape. See Elasticsearch.

curl -X POST https://api.warpsearch.io/compat/es/books/_search \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": {"bool": {
      "must": [{"match": {"title": "dune"}}],
      "filter": [{"range": {"year": {"gte": 1960, "lte": 1980}}}, {"term": {"genre": "scifi"}}]
    }},
    "sort": [{"year": "desc"}],
    "_source": ["title", "year"],
    "size": 10
  }'

The same _search body works on the OpenSearch endpoint. See OpenSearch.

curl -X POST https://api.warpsearch.io/compat/opensearch/books/_search \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": {"bool": {
      "must": [{"match": {"title": "dune"}}],
      "filter": [{"range": {"year": {"gte": 1960, "lte": 1980}}}, {"term": {"genre": "scifi"}}]
    }},
    "sort": [{"year": "desc"}],
    "_source": ["title", "year"],
    "size": 10
  }'

The same search as Solr select parameters, answered in Solr's response shape. See Solr.

curl "https://api.warpsearch.io/compat/solr/books/select" \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  --data-urlencode "q=title:dune" \
  --data-urlencode "fq=year:[1960 TO 1980]" \
  --data-urlencode "fq=genre:scifi" \
  --data-urlencode "sort=year desc" \
  --data-urlencode "fl=id,title,year" \
  --data-urlencode "rows=10"

The request needs the viewer role or higher. The path names the collection, or several as a comma-separated list (/v1/search/books,articles), which are searched and merged into one page. POST /v1/search without a collection takes it from the query itself: FROM in sql, pgsql and ppl. When both say, they must agree.

Request fields

Field Meaning
language The language of query: text (the default: the words a person typed, matched forgivingly), lucene, sql, pgsql, es, solr, logql, grafana, warpsearch, ppl, esql or cypher. See Query languages.
query The query. A string for most languages, a JSON object for es and grafana, either for text ({"text": ..., "fields": [...]}, see the text language). Omitted means match everything.
filters An array of non-scoring restrictions, written in the request's language. They narrow the matches without changing scores.
post_filters Like filters, but they narrow only the hits, not facets and metrics. See Faceted navigation.
sort An array such as ["year desc", "_score"], or objects such as {"field": "year", "desc": true}. With warpsearch, also expressions: {"expr": "...", "desc": true}. See Sorting.
diversify {"field": "brand_s", "max_per_key": 2}: at most that many hits per value. See Limit hits per value.
offset, limit Offset paging. Both count hits.
cursor, search_after Continue a supported field-sorted search. Use cursor: "*" for the first cursor page. See Paging.
fields Which fields to return for each hit.
facets, metrics Analytics over all matches. See Facets and aggregations.
time_range {"from": ..., "to": ..., "field": ...}: restrict to a time window, typically for logs and grafana.
time_zone Zone for date literals, date math and calendar buckets, for example America/Denver.
step The bucket width of a logql metric query, for example 1m.
default_operator OR (default) or AND for bare words in a Lucene-style query.
track_total Default true. Set false to skip counting every match.
scores Default true. Set false to skip returning scores.
sort_values Default false. Set true to return each hit's sort values under sort, one per sort key.
vars, signature Values for $name placeholders (warpsearch and ppl) and the signature of a replayed warpsearch query. See See the translation.
include_translation Adds translation to the response: the translated query, request details and a signed replay.
timeout_ms A search deadline, up to your plan's timeout.
max_rows, max_groups, max_bytes, max_parallel Caps for this request, each up to the plan's limit: offset + limit must fit max_rows; every facet's size is capped at max_groups; the uncompressed response at max_bytes; the fan-out over partitions or collections at max_parallel. With ppl they bound the pipeline's rows, groups, retained data and workers; see Limits and large inputs.

Unknown fields in the request are rejected with an error. The key is filters, an array; there is no filter. A pasted Elasticsearch _search body is rejected for the same reason: wrap it as {"language": "es", "query": <body>} or send it to the Elasticsearch endpoint.

Filters versus query

Put what should rank documents in query, and what should only include or exclude them in filters. A filter does not affect scores and costs less. Typical filters are tenant, category, status and date range. Filters are written in the request's language: Lucene strings for text, lucene, sql and most others, Query DSL objects for es, Solr query strings for solr.

{
  "query": "dune",
  "filters": ["genre:scifi", "year:>=1960"]
}

With "language": "es" the same filters are Query DSL objects:

{
  "language": "es",
  "query": {"match": {"title": "dune"}},
  "filters": [{"term": {"genre": "scifi"}}, {"range": {"year": {"gte": 1960}}}]
}

On /compat/es/{c}/_search (and the OpenSearch endpoint), filters go in a bool query's filter clause:

{
  "query": {"bool": {
    "must": [{"match": {"title": "dune"}}],
    "filter": [{"term": {"genre": "scifi"}}, {"range": {"year": {"gte": 1960}}}]
  }}
}

On /compat/solr/{c}/select, each filter is an fq parameter:

q=title:dune&fq=genre:scifi&fq=year:[1960 TO *]

Sorting

Sort by a field, by relevance, or by several keys in order: ["genre", "year desc", "_score"]. A sort without a direction is ascending for fields and descending for _score. Documents missing the sort value come last in either direction. The request's sort replaces any sort written in the query itself, such as an SQL ORDER BY.

You can sort on string, number and date values, and the es and solr languages can also sort by geo distance; see Sort by distance. A text field cannot be sorted by its whole value, so give it a string variant; see Variants. With one, sorting on the bare field name uses the variant.

With "sort_values": true, each hit carries its sort values, one per key: the score for _score, epoch milliseconds for dates, null where the document has no value. Searches in the es language and on the Elasticsearch endpoint return them whenever they sort. Use the last hit's values in a range filter to fetch the next page without a growing offset.

Sort by an expression

With "language": "warpsearch", a sort key can be a value expression, computed per document from its fields and the score. User values go in vars, as $name:

{
  "language": "warpsearch",
  "query": "title_t:dune",
  "sort": [{"expr": "def(rating_f, 0) * 2 + log1p(def(sales_i, 0))", "desc": true}, "id"],
  "vars": {}
}

Expression sorts are a strict order, like any sort: use them when a computed value should decide the order outright. To blend a signal with relevance instead, rescore the query; see Scoring expressions. Other languages return 400 for an expr sort. The same rules as for native queries apply: a free plan needs a signed request, and collections with row filters or restricted fields refuse expression sorts. See Who can send native queries.

Limit hits per value

diversify keeps at most max_per_key hits for each value of a field, so one brand, author or source cannot fill the page. Each value keeps its best hits in the search's own order, and the hits of other values move up:

{
  "query": "running shoes",
  "diversify": {"field": "brand_s", "max_per_key": 2},
  "limit": 20
}
Key Meaning
field One field, or a list of up to four fields whose combined values form the key. A single-valued string, id, integer or date field.
max_per_key At least 1.
missing Documents without a value: expand (the default; each is its own value, so none is capped), group (they share one value) or drop (left out).

total counts the documents left after the cap. Unlike collapse, which returns one hit per value with the others nested under it, diversify returns plain hits and allows several per value. diversify cannot be combined with collapse, rank fusion, cursor paging, several collections or partitioned collections, and it works in every language.

Paging

Paging is offset based: limit is the page size and offset the number of hits to skip. On the compatible endpoints they are Elasticsearch's size and from and Solr's rows and start.

{"query": "dune", "limit": 20, "offset": 40}

offset + limit cannot exceed your plan's result window, and limit cannot exceed the plan's maximum page size; going past either answers 422 limit_exceeded. Deep pages cost more than shallow ones because more matching results must be skipped, so show a few pages and let people narrow with filters rather than offering page 500.

For deeper paging, send cursor: "*" and an explicit field sort, then send the returned cursor with the same query, filters and sort. Alternatively pass the last hit's sort array as search_after. The id is added as a tie-breaker when needed.

{"language": "lucene", "query": "*:*", "sort": ["year", "_id"], "cursor": "*", "limit": 20}

Cursor paging requires offset: 0 and field sorts. Score, expression and distance sorts, missing sort values, custom sort mode/missing, kNN, fusion, collapse and diversify are not supported. Keep the query and sort fixed between pages. A short page has no next cursor. Requests do not share a snapshot: concurrent changes can move documents between pages.

Elasticsearch search_after and Solr cursorMark use this mechanism. Elasticsearch scroll is also served, but emulates pages with from/size, stops at the result window and returns a warning that writes can shift, repeat or skip hits. Point in time and slices remain unsupported.

Browse and export

POST /v1/collections/{c}/browse takes a search body and defaults to id order, no scores or total, and pages of 100 (subject to the plan's browse limit). Follow its returned cursor.

GET /v1/collections/{c}/export streams search hits as NDJSON. It accepts language, query, repeated filter parameters, comma-separated fields and sort. Export and timeout limits apply. An export of a partitioned collection does not provide a shared snapshot across partitions. If a failure occurs after streaming starts, the last line contains error; check it before treating an export as complete.

Counting

total is the exact number of matches by default, which means evaluating every matching document. When you do not display a total, set "track_total": false and the query can skip documents that cannot reach the top results, which makes broad queries on large collections much faster and cheaper. To count without fetching hits, use the count endpoint. It takes the same body as a search and ignores paging, facets and metrics:

curl -X POST https://api.warpsearch.io/v1/count/books \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language": "lucene", "query": "genre:scifi"}'
# {"count": 1204, "took_ms": 2}

POST /v1/count without a collection takes it from the query's FROM, like search.

curl -X POST https://api.warpsearch.io/compat/es/books/_count \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": {"term": {"genre": "scifi"}}}'
curl -X POST https://api.warpsearch.io/compat/opensearch/books/_count \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": {"term": {"genre": "scifi"}}}'

Elasticsearch requests also accept a positive track_total_hits integer for a bounded count. Some searches may still count exactly. Check hits.total.relation: gte means a lower bound, not an exact total. Native track_total remains a boolean. A search with aggregations or field sorting may still count exactly.

Choosing fields

fields limits what comes back, which keeps responses small and cheap. Without it you get every retrievable root field except vectors. Geo points are returned as [lon, lat]. Name a vector field to get it back. A hit that lacks a requested field omits that key. To get a field's variants back, name them, such as title__s, or match them with a pattern such as title__*. The compatible endpoints take the same list as Elasticsearch _source or Solr fl.

Collections whose class keeps document sources already use them for cloning and recovery. Search results and compatibility _source are still rebuilt from retrievable fields; they are not a verbatim copy of the submitted JSON. See Collections.

Elasticsearch and OpenSearch _search support completion, term and approximated phrase suggesters; Solr has suggest, spellcheck and terms handlers. See Elasticsearch and Solr for limits. More-like-this remains unsupported. For search boxes, the text language provides prefix matching and typo tolerance; see Synonyms, rules and ranking settings.

What each query type does

You write It does
A word (dune) on a text field Matches the word after analysis (case folded, stemmed for English fields) and scores with BM25.
A phrase ("way of kings") Matches the words in order. A slop ("way kings"~2) allows words in between.
A value on a string field Matches the whole value exactly.
A prefix, wildcard, regex or fuzzy term Matches indexed terms. Wildcard and regex depend on your plan. Fuzzy allows up to 2 edits. In the es language, case_insensitive on term, prefix, wildcard and regexp also matches other letter cases, as do SQL ILIKE and ~*.
A range (year:[1960 TO 1980]) Compares numbers, dates or terms. Dates accept date math such as now-30d.
A knn clause Finds nearest vectors; see Vector search.
Geo queries Distance, box, polygon, shape and grid-cell queries, nearest-k and distance scoring, in the es language, and {!geofilt}, {!bbox} and geodist() in solr. See Geo search.
A suffix or leading wildcard (*.exe) Fast on large dictionaries with a reversed variant and the rwildcard query, in the es language. See Suffix search.
A substring or pattern anywhere in a value Exact, including punctuation and values longer than 255 bytes, with a trigram variant and the substring query, in the es language. See Substring search.

To change how results are ordered, see Tuning relevance.

Dates and time zones

Dates in queries are interpreted in UTC unless the request sets time_zone. A partial date matches its whole window: 2026-06 is all of June. With a zone set, now/d starts at local midnight and calendar buckets follow local days across daylight-saving changes. Documents are always ingested in UTC; see Dates.

Warnings

A successful response can carry warnings, an array of strings that say where WarpSearch approximated something instead of rejecting it, for example a score approximation in an Elasticsearch multi_match or an analyzer that fell back to standard. Read them while you are building. Compatible endpoints also send them in a Warning: 299 response header.

Result shape

Field Meaning
took_ms Time spent on the search.
collection, offset The collection searched (a comma-separated list for several) and the offset of the first hit.
total Number of matches (exact unless track_total is false).
hits The page: each hit has id, score and fields, and sort with sort_values.
columns With ppl: the output columns (name, type, nullable), in order; each hit's fields are keyed by them.
facets, metrics Present when requested.
translation Present with include_translation: warpsearch (the native query), request, replay, warnings.
warnings Approximations and adjustments.

?format= picks the shape: native (default), es for an Elasticsearch-shaped response, or csv for a text/csv table (the columns of a pipeline, else id, score and the fields; facets and metrics are not rendered). The compatible endpoints always answer in their own API's shape.

Errors

Status Code Meaning
400 query_error The query could not be parsed. The detail says where.
400 unsupported_feature The query uses something WarpSearch does not offer. See Query languages.
400 invalid_field A field name does not exist or is not allowed.
403 forbidden Your key lacks the role on this collection.
404 not_found No such collection, or you have no role on it.
422 limit_exceeded A plan limit such as page size, result window, clauses or facets.
429 rate_limited Slow down; honor Retry-After.
503 warming_up The collection is loading. Retry after Retry-After.
504 timeout The request ran past your plan's time limit. Narrow it with filters.

The full list, with handling advice, is in Limits and errors.

Tips

Highlighting

Add highlight beside query to get matching snippets in each hit. The highlighted fields need not be in fields. See Highlighting for native and compatibility syntax.

View this page as Markdown

Cookie settings

Optional tracking stays off until you choose it. Your choice applies to this browser for 180 days. Read the details.

Essential storage keeps you signed in, protects forms, and remembers this choice. It is always available.