/ 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,
/ 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.
/ Delete,
/ IndexDelete an index
#
Deletes an existing index under a collection.
Examples
#
The following request deletes the index called my-index under collection
my-namespace:my-collection
DELETE /my-namespace:my-collection/_index/my-index
Request
#
DELETE /<target>/_index/<name>
Path parameters
#
<target>
(Required, string) The collection which the index will be removed from.
<name>
(Required, string) Name of the index you wish to delete.
/ Get,
/ IndexGet collection index
#
See the following documents:
/ Get,
/ IndexGet index
#
Returns information about one or more indices
Examples
#
Get the information of all indices:
Get the information of the index named my-index under collection my-collection:
GET /my-collection/_index/my-index
Request
#
GET /_index
GET /<target>/_index
GET /<target>/_index/<index>
Path Parameters
#
target
(Required, String) Comma-separated, names of the collections to specify (wildcard supported)
index
(Required, String) Comma-separated, names of the indices to get (wildcard supported)
...
/ Mapping,
/ IndexGet index mapping
#
Returns mapping information about one or more indices under the specified collection.
Examples
#
Get the mapping information of the my-index index under collection my-collection:
GET /my-collection/_index/my-index/_mapping
Request
#
GET /<target>/_index/<index>/_mapping
GET /<target>/_index/_mapping
Path Parameters
#
target
(Required, String) Comma-separated, names of the collections to specify (wildcard supported)
index
(Optional, String) Comma-separated, names of the indices to get (wildcard supported)
/ Setting,
/ IndexGet index settings
#
Returns setting information about one or more indices under the specified collection.
Examples
#
Get the setting information of the my-index index under collection my-collection:
GET /my-collection/_index/my-index/_settings
Request
#
GET /<target>/_index/<index>/_settings
GET /<target>/_index/_settings
Path Parameters
#
target
(Required, String) Comma-separated, names of the collections to specify (wildcard supported)
index
(Optional, String) Comma-separated, names of the indices to get (wildcard supported)
/ IndexIndex
#
An index is a specialized data structure designed to improve search performance
by efficiently organizing and storing data for quick retrieval. Each collection
has a default index called default. You can create additional indices, each
tailored to specific use cases to enhance search speed.
An index can manage various aspects such as mappings, settings, and aliases:
/ Fetch,
/ IndexFetch 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:
.../ Replace,
/ IndexReplace a document
#
Replace an existing document by specifying its unique identifier and the new content.
Examples
#
Replace a document news_001 of the collection my-collection with new content:
PUT /my-collection/_doc/news_001
{
"message": "GET /search HTTP/1.1 200 1070000",
"org": {
"id": "infinilabs"
}
}
The API returns as following result:
{"_id":"0,0", "_key":"news_001", "result":"updated"}
After the document modification, If you perform the fetch request:
GET /my-collection/_doc/news_001
It returns an updated document like:
{
"_collection": "default:my-collection",
"_id": "0,0",
"_key" : "news_001",
"found": true,
"source" : {
"message": "GET /search HTTP/1.1 200 1070000",
"org": {
"id": "infinilabs"
}
}
}
The replacement happens in place: the document keeps its original _id, and the
index entries of the old version are rebuilt under the same _id. Since this is
a full replacement, fields that are omitted from the request body are cleared.
...