DELETE /{index name}
PUT /{index name}
<!-- setting on request body -->
{
"settings": {
"number_of_shards": {n},
"number_of_replicas": {n}
}
}
it is more technically correct to say "index a document"
PUT /{index name}/_doc
<!-- content on request body -->
{
"name": "Coffee Maker",
"price": 64,
"in_stock": 10
}
{
"_index" : "products",
"_type" : "_doc",
"_id" : "oxshUdKes2203",
"_version" : 1,
"result" : "created",
"_shards" : {
"totla" : 3,
"successful" : 3,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
}
_shards : size of replication group (pri 1 + replica 2)
_id : identifier for doc
PUT /{index name}/_doc/{doc id}
GET /products/_doc/{doc id}
POST /{index name}/_update/{doc id}
{
"doc" : {
"{field name}" : {value}
}
}
POST /{index name}/_update/{doc id}
{
"script" : {
"source" : "ctx._source.{field name}--"
}
}
POST /{index name}/_update/{doc id}
{
"script" : {
"source" : "ctx._source.{field name} = 10"
}
}
POST /{index name}/_update/{doc id}
{
"script" : {
"source" : "ctx._source.{field name} -= params.{param name}",
"params" : {
"{param name}" : 4
}
}
}
updating based on existence of document
POST /{index name}/_update/{doc id}
{
"script" : {
"source" : "ctx._source.{field name}++"
},
"upsert": {
"{field name}" : "{value}"
}
}
PUT /{index name}/_doc/{doc id}
{
"{field name}" : {value}
}
DELETE /{index name}/_doc/{doc id}