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

Schemas and field types

A schema tells WarpSearch how to treat each field: whether to split text into words, keep values whole, compare numbers, bucket dates or index vectors. You give a collection a schema when you create it, read it back at any time, and extend it as your data grows. For common cases you can skip the declaration: a field-name suffix such as _t or _s chooses the type for you.

On native-schema collections, there is no dynamic typing beyond suffixes and templates. Elasticsearch and OpenSearch mappings also support dynamic mapping. A field that has no definition and matches no template is rejected when you index the document, so a typo cannot create a new field.

The examples use the WarpSearch API and its native schema format. Where the Elasticsearch, OpenSearch or Solr compatible APIs support the same operation, extra tabs show it there. See Elasticsearch, OpenSearch and Solr.

The schema document

A schema is one object with up to three top-level keys. The schema endpoints (PUT and GET) accept it as JSON or YAML: a body that starts with { is read as JSON, anything else as YAML. The create-collection call takes a JSON body, so there the schema is a JSON object.

Key Holds
fields Definitions of individual fields, keyed by field name.
templates Definitions that apply to every field whose name ends with the template name, such as _attr.
stored_resources Optional groups that control how stored text is compressed. Most schemas do not need it.

A definition is either a bare type name ("int") or an object of options.

{
  "fields": {
    "title":     {"type": "text", "analyzer": {"tokenizer": "unicode_word", "filters": ["nfkc_cf", "fold"]}},
    "brand":     "string",
    "tags":      {"type": "string", "multi": "set"},
    "year":      {"type": "int", "index": "range"},
    "price":     "double",
    "added":     "date",
    "store":     "geo_point",
    "embedding": {"type": "vector", "dims": 384, "metric": "cosine"}
  },
  "templates": {
    "_attr": "string"
  }
}
fields:
  title:
    type: text
    analyzer:
      tokenizer: unicode_word
      filters: [nfkc_cf, fold]
  brand: string
  tags: {type: string, multi: set}
  year: {type: int, index: range}
  price: double
  added: date
  store: geo_point
  embedding: {type: vector, dims: 384, metric: cosine}
templates:
  _attr: string

A schema you read back is always valid input for a write, so you can edit a schema by reading it, changing it and sending it back.

Field types

Type Use it for Notes
text Titles, descriptions, article bodies Split into words by an analyzer and searched with BM25. Cannot be sorted or faceted by whole value; add a string variant for that.
string Categories, tags, codes, anything matched whole Exact match, filtering, sorting, faceting. Not split into words.
int Counts, years, quantities Signed 64-bit integer.
float Measurements 32-bit floating point.
double Prices, scores, anything needing precision 64-bit floating point.
date Timestamps ISO-8601 text or epoch milliseconds, kept to the millisecond, or to the nanosecond with unit: "ns". See Dates.
boolean Flags true or false (also the strings "true" and "false"), stored as 1 or 0. Returned as JSON booleans.
ip IPv4 and IPv6 addresses Stored as a 16-byte value, so 10.0.0.1 and ::ffff:10.0.0.1 are the same address. Match an address or a CIDR block (10.0.0.0/8), or a range of addresses. Prefix, wildcard and regex queries are rejected.
decimal Money and other fixed-point numbers Needs scale, the number of digits after the decimal point (0 to 18). A value with more fractional digits is rejected, not rounded.
geo_point Locations Send [longitude, latitude], or GeoJSON, WKT, "lat,lon" or a geohash. Define it, or use the _p and _ps suffixes. See Geo points and queries.
geo_shape Areas, lines and points GeoJSON or WKT. See Geo shapes.
vector Embeddings Needs dims and, to search by nearest neighbor, a metric. See Vector fields.
id The document id Reserved for the built-in id field.

Nested documents

Nested documents keep the fields of each object in an array together. For example:

{"id": "shirt", "items": [{"color": "red", "size": "S"}, {"color": "blue", "size": "L"}]}

A nested query for a red size-L item must match both conditions in the same item, so this product does not match. Flattening the array loses that association and can incorrectly combine the color of one item with the size of another.

Nested indexing supports several levels of child objects. Replacing or deleting a parent also replaces or deletes its children; children are not independently addressable documents.

REST API limitation: nested schemas and queries are not currently available through the REST APIs described in this guide. This includes Elasticsearch nested, nested inner_hits and nested aggregations. Use a document per item when you need to query individual objects through these APIs, and keep a parent id to group the results.

Elasticsearch join fields and parent/child document APIs remain unsupported. For relationships between independently identified documents, see Graph search.

Text versus string

Both accept strings, but they make different things searchable. Take the value "Red Bicycle":

When one value needs both, give the field a string variant.

Field options

Every option is optional. An option you leave out is inherited from the definition's parent, and otherwise takes the type's default. The schema you read back stays as sparse as the one you wrote.

Option Applies to Meaning
type all One of the field types. Required unless inherited from a parent.
parent all Inherit every unset option from another field or template, such as _t.
index all match (a term index, for exact and text queries), range (a points index for fast numeric and geo ranges) or none. Text and strings index for match by default. Numbers live in a column and are scanned, which suits most workloads; set range when range queries must be fast.
column non-text Keep a per-field column of values, which sorting, faceting and numeric queries use. On by default for non-text types.
multi all false (one value), true (the type's default multi-value mode), "set" (sorted and de-duplicated) or "array" (source order and repeats kept).
analyzer text A registered analyzer name, or an object of tokenizer, filters and char_filters. See Analyzers.
normalizer string A list of filters applied to each whole value, such as lowercase, nfkc_cf, fold or trim. See Normalizers.
long_terms string, text What to do with a term over 255 bytes: hash128 (default; keeps long values distinct), truncate (keep the first 255 bytes, so values can merge) or reject (fail the document).
stored text, string Keep the original text so it can be returned. On by default for text only.
stored_resource text, string Name of a stored_resources group. Group names start and end with _, for example _stored_logs_.
variants scalar, vector, geo Other ways of indexing the same value. See Variants.
defaults fields with variants {search, value}: which representation a bare field name means for searching and for sorting and faceting.
scale decimal Digits after the decimal point, 0 to 18. Required for decimal.
unit date ms (default) or ns: the precision dates are stored and compared at. It cannot change once set.
dims vector Number of components.
metric vector l2, ip, cosine or none (stored, not searchable).
normalized vector Cosine only. You promise that every vector already has unit length.
normalize_on_write vector Cosine only. On by default: vectors are stored at unit length.
truncate_dims vector Keep only the first N components, for Matryoshka models. See Matryoshka embeddings.
ann vector Approximate index settings: codec (pq or rabitq), nlist, pq: {m, bits} and rabitq: {bits, query_bits}. See Vector search.

Unknown options are rejected with a 400 that names them.

Names

Field names use ASCII letters, digits and _, start with a letter, never contain __ and are at most 127 characters. Template names are _ followed by letters, digits or _. A schema holds at most 5000 fields and templates together.

Create a collection with a schema

Send the schema under schema when you create the collection. Creating needs the editor role.

curl -X PUT https://api.warpsearch.io/v1/collections/products \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Product catalog",
    "schema": {
      "fields": {
        "name":      {"type": "text", "variants": {"s": "string"}},
        "brand":     "string",
        "price":     "double",
        "released":  "date",
        "location":  "geo_point",
        "embedding": {"type": "vector", "dims": 768, "metric": "cosine"}
      }
    }
  }'

The same collection through the Elasticsearch-compatible endpoint, with an Elasticsearch mapping:

curl -X PUT https://api.warpsearch.io/compat/es/products \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mappings": {
      "properties": {
        "name":      {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
        "brand":     {"type": "keyword"},
        "price":     {"type": "double"},
        "released":  {"type": "date"},
        "location":  {"type": "geo_point"},
        "embedding": {"type": "dense_vector", "dims": 768, "similarity": "cosine"}
      }
    }
  }'

The same collection through the OpenSearch-compatible endpoint. Vectors use knn_vector:

curl -X PUT https://api.warpsearch.io/compat/opensearch/products \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "settings": {"index": {"knn": true}},
    "mappings": {
      "properties": {
        "name":      {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
        "brand":     {"type": "keyword"},
        "price":     {"type": "double"},
        "released":  {"type": "date"},
        "location":  {"type": "geo_point"},
        "embedding": {"type": "knn_vector", "dimension": 768,
                      "method": {"name": "hnsw", "space_type": "cosinesimil"}}
      }
    }
  }'

An Elasticsearch or OpenSearch mapping is translated into a WarpSearch schema when the collection is created, so you can read the result back with GET /v1/collections/products/schema. The translation maps text to text, keyword to string, the integer types to int, float and half_float to float, double to double, scaled_float to decimal (with a power-of-ten scaling_factor; values are rounded to it when written), boolean to boolean, ip to ip, date to date, date_nanos to a date with unit: "ns", geo_point to geo_point, and dense_vector and knn_vector to vector. Details and limits are in Elasticsearch and OpenSearch.

The create_collection tool of the MCP server takes the same object as its schema argument. See Guide for AI agents.

Read the schema

curl https://api.warpsearch.io/v1/collections/products/schema \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

# the same schema as YAML
curl https://api.warpsearch.io/v1/collections/products/schema \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Accept: application/yaml"
curl https://api.warpsearch.io/compat/es/products/_mapping \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"
curl https://api.warpsearch.io/compat/opensearch/products/_mapping \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

Field types are reported as Solr names such as text_general, string and pdouble:

curl https://api.warpsearch.io/compat/solr/products/schema/fields \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY"

Reading needs the viewer role. GET /v1/collections/{c} also lists each field with its type.

Add and change fields

PUT on the schema takes a schema document and sets the fields and templates it names, leaving everything else in the schema alone. A field you name has its whole definition replaced, so send the complete definition, not a fragment. Setting needs the editor role, and the response is the resulting schema.

curl -X PUT https://api.warpsearch.io/v1/collections/products/schema \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fields": {"rating": "float", "sku": "string"}}'

The body can be YAML as well:

curl -X PUT https://api.warpsearch.io/v1/collections/products/schema \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/yaml" \
  --data-binary $'fields:\n  rating: float\n  sku: string\n'

PUT /{index}/_mapping adds fields:

curl -X PUT https://api.warpsearch.io/compat/es/products/_mapping \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"properties": {"rating": {"type": "float"}, "sku": {"type": "keyword"}}}'

A new vector field through PUT /{index}/_mapping:

curl -X PUT https://api.warpsearch.io/compat/opensearch/products/_mapping \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"properties": {"image_embedding": {"type": "knn_vector", "dimension": 512,
        "method": {"name": "hnsw", "space_type": "l2"}}}}'

The Solr Schema API's add-field:

curl -X POST https://api.warpsearch.io/compat/solr/products/schema \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"add-field": [{"name": "rating", "type": "pfloat"}, {"name": "sku", "type": "string"}]}'

Adding a field never touches existing documents. Only documents written afterwards carry its values.

Changes that are refused

Some properties decide how already indexed values were stored, and changing them would make the existing data unreadable or wrong. A change to any of these is refused with 409 incompatible_schema, naming the field:

{
  "type": "https://warpsearch.io/docs/errors/incompatible_schema",
  "title": "Conflict",
  "status": 409,
  "code": "incompatible_schema",
  "detail": "field \"year\": the type cannot change from int to string; add a new field (or a variant) and reindex instead",
  "request_id": "7d1c1a3e0f9b4c2e"
}

Adding fields and templates is always allowed, and so are changes that apply only to data written later: ann settings and long_terms. Vector storage encoding is not configurable through the schema API. The same checks apply when you change a schema through the Elasticsearch-compatible _mapping endpoint or the Solr Schema API.

To change a field, add a new field (or a variant) with the definition you want, reindex your source data into it, and switch your queries over. Removing a field and reusing its name does not erase the old indexed values.

Templates and suffixes

A template is a definition that applies to every field whose name ends with the template name. A template named _attr covers shoe_attr, socket_attr and any other field ending in _attr, including fields that appear later, with no schema update. Use templates for fields you cannot list in advance, such as per-category product attributes.

{
  "fields": {"productname": {"parent": "_t"}},
  "templates": {"_attr": "string"}
}

With that schema, this document needs nothing more:

{"id": "shoe1", "productname": "Trail shoes", "shoe_width_attr": "wide"}

An explicit field definition always wins over a template. A definition can name a template as its parent to inherit its properties, as productname does above.

Built-in suffixes

These templates exist in every collection, so a field named with one of these suffixes is typed without any declaration:

Suffix Type and behavior
_t text. Unicode word splitting, case and accent folding, English possessive removal and English stemming. The general-purpose text field.
_u text. Unicode words, case and accent sensitive.
_un text. Unicode words with case folding; accents kept, no stemming.
_w text. Split on whitespace, case and accent sensitive.
_wl text. Split on whitespace and lowercased.
_s string, indexed for exact match, with a column for sorting and facets.
_sc string, column only (no term index).
_ss, _ssc Multi-valued forms of _s and _sc.
_i, _is int, single or multi-valued.
_f, _fs float, single or multi-valued.
_d, _ds double, single or multi-valued.
_dt, _dts date, single or multi-valued.
_b, _bs boolean, single or multi-valued.
_ip, _ips ip, single or multi-valued.
_name, _names A names field: searchable by word, with the whole value kept for facets and sorting (a text field with a string variant). _names is multi-valued.
_p, _ps geo_point with a points index (index: "range"), single or multi-valued.
_v, _vs vector, single or multi-valued. Stored only, until a field definition gives it a metric.
{"id": "b1", "title_t": "The Way of Kings", "genre_s": "fantasy", "year_i": 2010,
 "tags_ss": ["epic", "fantasy"], "published_dt": "2010-08-31"}

These suffixes are a WarpSearch convention, not a feature of Elasticsearch, OpenSearch or Solr, although the compatible APIs accept documents that use them. Text fields are stored in the default compressed group, and numeric suffix fields are column-backed without a points index; define the field and set index: "range" when range queries must be fast.

Variants

A variant is another way of indexing a field's value. You send the value once, under the field's name, and the schema indexes it in as many configurations as you list: by word and as a whole value, with and without stemming, forward and reversed, or at two vector sizes. Each variant is its own index named <field>__<label>, built from the same submitted value. The document and the stored copy of the value stay single. Elasticsearch calls this feature multi-fields.

Example

A brand name should be searchable by word (acme finds "Acme Footwear"), but facets and sorting need the whole name. Give the field a string variant labeled s:

{
  "fields": {
    "brand": {"parent": "_un", "variants": {"s": "string"}}
  }
}

The documents carry the value once:

{"id": "b1", "brand": "Acme Footwear"}
{"id": "b2", "brand": "Acme Footwear"}
{"id": "b3", "brand": "Acme Outdoor"}

A request then names only brand, and WarpSearch picks the representation each part needs:

curl -X POST https://api.warpsearch.io/v1/search/shoes \
  -H "Authorization: Bearer $WARPSEARCH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "language": "lucene",
    "query": "brand:acme",
    "sort": ["brand"],
    "fields": ["brand", "brand__s"],
    "facets": {
      "by_brand": {"type": "terms", "field": "brand", "size": 10},
      "by_word":  {"type": "terms", "field": "brand__self", "size": 10}
    }
  }'
{
  "total": 3,
  "hits": [
    {"id": "b1", "fields": {"brand": "Acme Footwear", "brand__s": "Acme Footwear"}},
    {"id": "b2", "fields": {"brand": "Acme Footwear", "brand__s": "Acme Footwear"}},
    {"id": "b3", "fields": {"brand": "Acme Outdoor", "brand__s": "Acme Outdoor"}}
  ],
  "facets": {
    "by_brand": {"type": "terms", "field": "brand", "buckets": [
      {"value": "Acme Footwear", "count": 2}, {"value": "Acme Outdoor", "count": 1}]},
    "by_word": {"type": "terms", "field": "brand__self", "buckets": [
      {"value": "acme", "count": 3}, {"value": "footwear", "count": 2}, {"value": "outdoor", "count": 1}]}
  }
}

The query matches by word, the sort and the first facet use the whole value, and the second facet counts words. The next section explains how each part got its representation.

Which representation a request uses

A bare field name, such as brand, means different representations for different operations. Two bindings decide it: search for text operations and value for everything that compares or groups whole values. You can write them in the field's defaults object, but you rarely need to, because they are inferred from the types:

Primary type search binding value binding
text the field itself its only string variant, otherwise the field itself
string its only text variant, otherwise the field itself the field itself
any other type the field itself the field itself
Operation on a bare name Uses
Word queries: match, phrases, bare words in a query string, prefix, wildcard, regex and fuzzy search binding
Exact value filters, ranges, sorting, facets and metrics value binding
Field existence, nearest-neighbor and geo queries the field itself
Returning the field in fields the field itself (see Storage)

A selector bypasses the bindings. brand__s names the s variant and brand__self names the field itself, in queries, filters, sorts, facets, metrics and fields. __self is how you facet on the words of a text field that has a string variant, as in the example above. Selectors only exist in requests: documents are always written under the plain field name, and a document key that contains __ is rejected.

Each operation still needs its representation to support it. Sorting on a variant that is index-only with no column fails with an error; WarpSearch does not quietly pick another representation.

To set a binding yourself, name self or a variant label:

{"title": {"type": "text", "variants": {"s": "string", "raw": "string"}, "defaults": {"value": "s"}}}

A text field with several string variants must set defaults.value, and a string field with several text variants must set defaults.search. Otherwise the schema is rejected as ambiguous.

Storage and retrieval

The value is kept once. stored, stored_resource and multi belong to the field, and a variant cannot set them. Variants hold only their own index data: terms for searching and, for non-text types, a column for sorting, faceting and returning values.

A variant costs about what a separate field of its type would: its own terms and column. The original value is not duplicated.

Rules

Variants in templates

A template can carry variants, so every field that uses it gets them with no schema update. The built-in _name and _names suffixes are exactly the example above: a word-searchable text field with a string variant s, and defaults.value set to s. A field named author_name therefore also indexes author_name__s.

Define your own the same way:

{
  "templates": {
    "_title": {"parent": "_t", "variants": {"s": "string"}}
  }
}

A field named book_title now indexes book_title with _t word analysis and book_title__s with the whole value.

variants and defaults are inherited as a whole, never merged label by label. A definition that leaves them out inherits both. One that sets variants replaces all inherited labels, and {} clears them. If the inherited defaults names a label that no longer exists, the schema is rejected as a dangling default, so replace or clear defaults along with variants:

{
  "fields": {
    "inherited": {"parent": "_name"},
    "replaced":  {"parent": "_name", "variants": {"raw": "string"}, "defaults": {}},
    "cleared":   {"parent": "_name", "variants": {}, "defaults": {}}
  }
}

inherited keeps s. replaced has only raw, and its value binding is inferred from it. cleared is a plain text field.

Elasticsearch multi-fields

A multi-field in an Elasticsearch mapping becomes a variant. The mapping

{"properties": {"title": {"type": "text", "fields": {"keyword": {"type": "keyword"}}}}}

creates the field title with the variant title__keyword. Elasticsearch and OpenSearch clients keep writing title.keyword in queries, sorts and aggregations, and the compatible endpoint maps the name for them. On the WarpSearch API, use the selector title__keyword. Elasticsearch's copy_to is a different feature: it appends a value to another field. See Elasticsearch.

Adding a variant later

Adding a variant does not change older documents. Only documents written afterwards carry its values, so reindex to fill it. Reindex from your source data rather than from values read back from the field, because each variant converts the submitted value on its own.

Adding a variant can also change a binding straight away. If a text field has no string variant, a sort on it is refused. Once you add one, the bare name sorts and facets on the new variant, which is empty until you reindex. To roll out without a gap, pin the binding to the field itself first:

{"title": {"type": "text", "variants": {"s": "string"}, "defaults": {"value": "self"}}}

Reindex, then query the variant by selector (title__s) or set defaults to {} to return to inference. To change how a variant analyzes its value, add a new label and reindex, as under Changes that are refused.

Analyzers

A text field has an analyzer that splits and normalizes text, at index time and at query time. An analyzer is an ordered list of char_filters run on the whole value, one tokenizer, and an ordered list of token filters. Each component is a name, or an object {"name": ..., "params": {...}}.

{
  "fields": {
    "body": {
      "type": "text",
      "analyzer": {
        "char_filters": ["html_strip"],
        "tokenizer": "unicode_word",
        "filters": ["nfkc_cf", "fold", "kstem"]
      }
    }
  }
}
Component Kind Meaning
unicode_word tokenizer Unicode word segmentation.
whitespace tokenizer Split on whitespace. The default when an analyzer lists filters but no tokenizer.
keyword tokenizer The whole value as one token.
html_strip char filter Strip HTML markup before tokenizing.
nfkc_cf filter Unicode NFKC case folding. Prefer it to lowercase for Unicode text.
lowercase filter Unicode lowercasing only.
fold filter Accent and diacritic folding.
english_possessive filter Remove a trailing 's.
kstem filter English stemming (ponies matches pony). By default it also removes possessives; pass {"name": "kstem", "params": {"possessive": false}} to stem only.
stop filter Remove the words in the required params.words list.

Naming a tokenizer or listing any filter replaces the whole inherited chain. A bare "type": "text" with no inherited analyzer splits on whitespace and applies no filters, so give text fields an analyzer or use a _t name. Prefix, wildcard and fuzzy query terms get the field's case and accent folding but not stemming. string normalizers accept the filters that change characters without splitting or removing tokens, such as lowercase, nfkc_cf, fold, uppercase and trim; see Normalizers.

Many more components and ready-made analyzers are described in Languages and text analysis: analyzers for Arabic, Persian, Hindi, Turkish and other languages, Hebrew, Japanese, Korean and Chinese, Snowball stemming in 35 languages, language detection, ICU folding, normalization and transliteration, source code, phone numbers and command lines; pattern, word delimiter, path and length filters; synonym filters; n-grams and shingles; phonetic matching; and the reversed and trigram variants for suffix and substring search.

Custom Elasticsearch and OpenSearch analyzers and Solr field types sent through the compatible APIs are translated to these components with their parameters; see Through the compatible APIs.

Vector fields

A vector field needs dims, and a metric to be searchable by nearest neighbor.

{
  "fields": {
    "embedding": {"type": "vector", "dims": 768, "metric": "cosine"},
    "summary":   {"type": "vector", "dims": 1024, "truncate_dims": 256, "metric": "cosine"},
    "passages":  {"type": "vector", "dims": 768, "metric": "cosine", "multi": true,
                  "ann": {"codec": "rabitq", "rabitq": {"bits": 1}}}
  }
}

An Elasticsearch mapping expresses only the dimension and similarity:

{
  "properties": {
    "embedding": {"type": "dense_vector", "dims": 768, "similarity": "cosine"}
  }
}

An OpenSearch mapping expresses only the dimension and space type:

{
  "properties": {
    "embedding": {"type": "knn_vector", "dimension": 768,
                  "method": {"name": "hnsw", "space_type": "cosinesimil"}}
  }
}

Metrics map as cosine and cosinesimil to cosine, l2_norm and l2 to l2, and dot_product, max_inner_product and innerproduct to ip. Options such as truncate_dims and ann are configured through the native schema. The schema API does not accept encoding or metric: "hamming". keep_original and multi_vector_scoring are not supported schema options. See Vector search, Dimensions and storage trade-offs and Multi-vector fields.

Dates

A date field takes epoch milliseconds or an ISO-8601 string: 2026-06-25T10:30:00Z, 2026-06-25T10:30:00-05:00, 2026-06-25 or 2026-06. A date without a zone is read as UTC at ingest, so use an explicit Z or offset in documents when the exact instant matters. For dates in queries, including partial dates, date math and time_zone, see Dates and time zones.

Dates are kept to the millisecond. For nanosecond timestamps, such as high-resolution logs or traces, define the field with unit: "ns":

{"fields": {"event_time": {"type": "date", "unit": "ns"}}}

A nanosecond field stores, sorts and compares to the nanosecond, and ISO-8601 values in queries keep their full precision ("2026-01-01T00:00:00.123456789Z"). Numbers in queries and everything search results return (field values, sort values, facet keys, date metrics) are in milliseconds, as for every other date. Nanosecond fields cover 1677 to 2262. The unit cannot change once the field exists. Score functions such as decays cannot use a nanosecond field.

Checks at ingest

Values are checked against the field's type when a document is indexed. A value that cannot be converted fails that document only, with the code invalid_value and a message that names the field. The rest of the batch is indexed.

{
  "status": "partial",
  "indexed": 1,
  "failed": 1,
  "errors": [
    {"index": 1, "id": "b2", "code": "invalid_value", "message": "field 'year': cannot parse 'abc' as an integer"}
  ]
}

See Ingesting documents.

What you get back

Search hits return the fields you ask for in fields. Text and string values come back as sent, and numbers and dates come back from their stored values. Vectors are returned only when you name them. Geo points come back as [lon, lat] and shapes as GeoJSON; see Return points.

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.

Gotchas

See also Collections, Ingesting documents, Vector search and the REST API reference.

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.