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:

{
  "_id": "0,0",
  "_version": 1,
  "_namespace": "default",
  "_collection": "my-collection",
  "_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 #

POST /<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.
Calendar March 9, 2024
Edit Edit this page