/ Create,
/ CollectionCreate a collection
#
Creates a new collection.
Examples
#
The following request creates a new collection called my-collection in the
namespace my-namespace:
PUT /my-namespace:my-collection
If creating a collection within the default namespace, it can be simplified as:
Request
#
PUT /[<namespace>:]<name>
Path parameters
#
<namespace>
(Optional, string) The namespace which the collection belongs to. Namespace names
must meet the following criteria:- Lowercase only
- Cannot include
\ /, *, ?, ", <, >, |, , ,, # - Cannot start with
-, _, + - Cannot be
. or .. - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters
will count towards the 255 limit faster)
<name>
(Required, string) Name of the collection you wish to create. Collection names
must meet the same criteria as namespace names.
Query parameters
#
/ Create,
/ IndexCreate 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:
{
"_collection": "default:my-collection",
"_id": "0,0",
"result": "created",
"_shards": { "total": 2, "successful": 1, "failed": 0 }
}
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"
}
}
The keyed form answers with the user key as _key:
.../ Create,
/ NamespaceCreate a namespace
#
Creates a new namespace.
Examples
#
If creating a website namespace, the following request creates a new namespace called website:
Request
#
/_ns/<name> is accepted as a shorter alias.
Path parameters
#
<name>
(Required, string) The name of the namespace. Namespace names
must meet the following criteria:- Lowercase only
- Cannot include
\ /, *, ?, ", <, >, |, , ,, # - Cannot start with
-, _, + - Cannot be
. or .. - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters
will count towards the 255 limit faster)
/ Create,
/ IndexCreate an index
#
Creates a new index under a collection.
Examples
#
The following request creates a new index called my-index under collection
my-namespace:my-collection
PUT /my-namespace:my-collection/_index/my-index
Request
#
PUT /<target>/_index/<name>
Path parameters
#
<target>
(Required, string) The collection which the index belongs to.
<name>
(Required, string) Name of the index you wish to create.