其他分享
首页 > 其他分享> > ES 常用语句增删改查

ES 常用语句增删改查

作者:互联网

GET _cluster/health

{
  "cluster_name": "elasticsearch",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 16,
  "active_shards": 16,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 16,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 50
}
GET _cat/indices?v

health status index      uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   test_type  ZTEhg0JqQiC3rn_afvle5Q   5   1          1            0      4.1kb          4.1kb
yellow open   test_index C-03qY6HRWCuCVPvNgRD2w   5   1          2            0      7.2kb          7.2kb
yellow open   ecommerce  84jwaWkVSDKtBHVfGOn8TQ   5   1          2            0     10.2kb         10.2kb
yellow open   .kibana    XsGtygBSQb-MNkbAPCbI9Q   1   1          1            0      3.1kb          3.1kb
PUT /test_index

创建完成后,再执行 GET _cat/indices?v 就能看到创建的 /test_index 索引了
DELETE /test_index

删除完成后,再执行 GET _cat/indices?v 就看不到已经删除的 /test_index 索引了
PUT /index/type/id
{
	json数据
}

PUT /ecommerce/product/100
{
    "name":"yunnanbaiyao",
    "desc":"laji",
    "price":40,
    "producer":"yunnanyaoshi",
    "tags":["haha","heihei"]
}
PUT /index/type/id
{
	json数据
}

PUT /ecommerce/product/100
{
    "name":"plus yunnanbaiyao",
    "desc":"laji",
    "price":40,
    "producer":"yunnanyaoshi",
    "tags":["haha","heihei"]
}
POST /index/type/id/_update
{
	"doc":{json数据}
}

POST /ecommerce/product/100/_update
{
  "doc": {"name":"hahahhaha"}
}
GET /index/type/id

GET /ecommerce/product/100

执行该命令,就能看到我们刚才通过PUT创建的文档了
DELETE /index/type/id

DELETE /ecommerce/product/100

标签:index,kb,GET,改查,shards,增删,type,ecommerce,ES
来源: https://www.cnblogs.com/rocker-pg/p/14673031.html