Elasticsearch6.2.2说明文档--index操作
2018-03-13 13:51
260 查看
环境: Elasticsearch: 6.2.2 Kibana: 6.2.2 os: centos 7 原文地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/_index_and_query_a_document.html 原文地址:https://www.elastic.co/guide/en/elasticsearch/reference/current/_list_all_indices.html
1、查看所有index,即查看indices 命令:GET /_cat/indices?v 结果:
结果中包含每一个index的健康状态,名称,以及一些存储信息。 2、创建index 命令:PUT /customer?pretty 该命令是创建一个名为customer的index,后面的pretty参数只是为了得到一个美化后的响应结果
使用 GET /_cat/indices?v 查看刚才创建的index,我们可以看到主分区为5个,副分区为1个,这些都是ES默认值,如果此时你的单节点ES,你会发现此时index的状态为yellow,参考状态说明,我们可以知道,是因为单节点不符合HA,所以为黄色。3、插入document 命令:
PUT /customer/_doc/1?pretty
{
"name": "John Doe"
}
结果:
另外ES在插入document的时候不需要提前创建index,如果不存在该index,则会自动创建然后插入。
4、删除index 命令:DELETE /customer 然后 GET /_cat/indices?v 则再没有名字为customer的index 总结:有上面示例中可以看出,再ES中数据处理的模式为:<REST Verb> /<Index>/<Type>/<ID>
1、查看所有index,即查看indices 命令:GET /_cat/indices?v 结果:
结果中包含每一个index的健康状态,名称,以及一些存储信息。 2、创建index 命令:PUT /customer?pretty 该命令是创建一个名为customer的index,后面的pretty参数只是为了得到一个美化后的响应结果
使用 GET /_cat/indices?v 查看刚才创建的index,我们可以看到主分区为5个,副分区为1个,这些都是ES默认值,如果此时你的单节点ES,你会发现此时index的状态为yellow,参考状态说明,我们可以知道,是因为单节点不符合HA,所以为黄色。3、插入document 命令:
PUT /customer/_doc/1?pretty
{
"name": "John Doe"
}
结果:
另外ES在插入document的时候不需要提前创建index,如果不存在该index,则会自动创建然后插入。
4、删除index 命令:DELETE /customer 然后 GET /_cat/indices?v 则再没有名字为customer的index 总结:有上面示例中可以看出,再ES中数据处理的模式为:<REST Verb> /<Index>/<Type>/<ID>
相关文章推荐
- Elasticsearch6.2.2说明文档--数据操作(Document操作)
- Elasticsearch6.2.2说明文档--Mapping
- Elasticsearch6.2.2说明文档--集群健康监测
- Elasticsearch6.2.2说明文档--基本概念
- elasticsearch-系列文档说明
- elasticsearch 第五篇(文档操作接口)
- ElasticSearch 6.x 学习笔记:28.Java API之文档批量操作
- 企业级搜索elasticsearch应用01-单机安装和索引文档操作
- XMLDLL操作说明文档(三)
- jenkins 命令行操作说明文档
- elasticsearch6操作说明
- 为JSDoc3的index.html增加说明文档
- XMLDLL操作说明文档(四)
- Elasticsearch学习系列之多文档操作mget
- Elasticsearch 文档更新操作
- Elasticsearch索引和文档操作
- elasticsearch-java api之索引(index)的各种操作
- 第三百六十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)基本的索引和文档CRUD操作、增、删、改、查
- C 语言字符串操作函数API文档说明
- SosoApi使用说明-基本操作文档