Fetch a document

Fetch a document #

Retrieve an existing document by specifying its unique identifier.

Examples #

Fetch a document from the my-collection collection with customized uuid news_001:

GET /my-collection/_doc/news_001

The API returns the following result:

{
  "_collection": "default:my-collection",
  "_id": "0,0",
  "_key" : "news_001",
  "found": true,
  "source" : {
    "message": "GET /search HTTP/1.1 200 1070000",
    "org": {
      "id": "infini"
    }
  }
}

As you can see, the customized uuid are represented as _key within the document, and there is also a _id returned with value 0,0, this is the internal id generated by Pizza, and it is guaranteed to be unique, so you can also fetch this document by this value like this:

GET /my-collection/_doc/0,0

Request #

GET /<target>/_doc/<doc_id>

Path parameters #

  • <target>
    (Required, string) Name of the collection to target.
  • <doc_id>
    (Required, string) The unique identify of this document, support both _key or _id.

Query parameters #

  • key_as_id
    (Optional, boolean) compatibility rendering: a keyed document answers with the user key AS _id (and the now-redundant _key folded away). The default keeps the system _id and reports the key as _key. Defaults to false.
  • routing
    (Required for a key-addressed fetch on a routed collection) — the routing VALUE (?routing=org-a) that places the document. A bare key has no home partition there and answers 400; a value pointing at the wrong partition is an honest 404. On collections without a routing field the parameter addresses nothing and is a 400.

You can also use the HEAD method to simply find if the specified document exists or not.

HEAD /<target>/_doc/<doc_id>
Calendar October 6, 2026
Edit Edit this page