Create a document

Create a document #

Creates a new document.

Examples #

Insert a JSON document into the my-collection collection:

POST /my-collection/_doc
{
  "message": "GET /search HTTP/1.1 200 1070000",
  "org": {
    "id": "infini"
  }
}

The API returns the following result:

{
  "_id": "0,0",
  "_version": 1,
  "_namespace": "default",
  "_collection": "my-collection",
  "result": "created",
  ...
}

The API supports passing a customized UUID as the document identify, eg:

POST /my-collection/_doc/news_001
{
  "message": "GET /search HTTP/1.1 200 1070000",
  "org": {
    "id": "infini"
  }
}

Request #

POST /<target>/_doc/[<doc_id>]
{<fields>}

Path parameters #

  • <target>
    (Required, string) Name of the collection to target.
    • <doc_id>
      (Optional, string) The unique identify of the document, auto generated if not specified.

Request body #

  • <fields>
    (Required, string) Request body contains the JSON source for the document data.
Calendar August 28, 2024
Edit Edit this page