本篇内容介绍了“ElasticSearch怎么查看、删除以及创建索引”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
GET http://{{es-host}}/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1565356074 13:07:54 elasticsearch green 3 3 10 5 0 0 0 0 - 100.0%
GET http://{{es-host}}/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open ecommerce YO4DgZuSTe23piO6hjF--w 5 1 3 0 34.2kb 17.1kb
GET http://{{es-host}}/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name 192.168.100.102 35 95 0 0.04 0.04 0.05 mdi - es-node3 192.168.100.102 23 95 0 0.04 0.04 0.05 mdi * es-node1 192.168.100.102 35 95 0 0.04 0.04 0.05 mdi - es-node2
PUT http://{{es-host}}/test-index?pretty
DELETE http://{{es-host}}/test-index
(1)、
PUT http://{{es-host}}/ecommerce/produce/1
{
"name":"gaolujie yagao",
"desc":"gaoxiao meibai",
"price":30,
"producer":"gaolujie producer",
"tags":[
"meibai","fangzhu"
]
}
结果:
{
"_index": "ecommerce",
"_type": "produce",
"_id": "1",
"_version": 10,
"result": "created",
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"created": true
}
(2)、
PUT http://{{es-host}}/ecommerce/produce/2
{
"name":"jiajieshi yagao",
"desc":"youxiao fangzhu",
"price":25,
"producer":"jiajieshi producer",
"tags":[
"fangzhu"
]
}
(3)、
PUT http://{{es-host}}/ecommerce/produce/3
{
"name":"zhonghua yagao",
"desc":"caoben zhiwu",
"price":40,
"producer":"zhonghua producer",
"tags":[
"qingxin"
]
}
GET http://{{es-host}}/ecommerce/produce/1
查询结果:
{
"_index": "ecommerce",
"_type": "produce",
"_id": "1",
"_version": 7,
"found": true,
"_source": {
"name": "gaolujie yagao",
"desc": "gaoxiao meibai",
"price": 30,
"producer": "gaolujie producer",
"tags": [
"meibai",
"fangzhu"
]
}
}
POST http://{{es-host}}/ecommerce/produce/1/_update
{
"doc":{
"price":30
}
}
PUT http://{{es-host}}/ecommerce/produce/1
{
"name":"gaolujie yagao1",
"desc":"gaoxiao meibai",
"price":30,
"producer":"gaolujie producer",
"tags":[
"meibai","fangzhu"
]
}
结果:
{
"_index": "ecommerce",
"_type": "produce",
"_id": "1",
"_version": 8,
"result": "updated",
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"created": false
}
DELETE http://{{es-host}}/ecommerce/produce/1
结果:
{
"found": true,
"_index": "ecommerce",
"_type": "produce",
"_id": "1",
"_version": 9,
"result": "deleted",
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
}
}
“ElasticSearch怎么查看、删除以及创建索引”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/shxjinchao/blog/3089295