ElasticSearch常用命令
索引、文档、映射
1、查看文档
1 | get http://127.0.0.1:9200/shopping/_doc/1 |
2、查询索引中的所有文档
1 | get http://127.0.0.1:9200/product/_search |
3、集群节点
1 | get http://192.168.159.110:9200/_cat/nodes |
4、集群状态
1 | get http://192.168.159.110:9200/_cluster/health |
5、创建索引
1 | put http://127.0.0.1:9200/shopping |
6、查看所有索引
1 | get http://127.0.0.1:9200/_cat/indices?v |
7、创建文档
1 | post http://127.0.0.1:9200/shopping/_doc |
8、创建映射
1 | put http://127.0.0.1:9200/student/_mapping (索引student要先创建) |
9、更新文档
1 | post http://127.0.0.1:9200/shopping/_doc/1001?version=3&version_type=external |
- HTTP 方法:POST
- Elasticsearch 服务器地址:http://127.0.0.1:9200
- 索引名称:shopping
- 文档类型:_doc
- 文档ID:1001
- 参数 version=3:表示要更新文档的版本号为3。
- 参数 version_type=external:指定版本控制的类型为 “external”,这意味着版本号由外部控制,而不是 Elasticsearch 自动生成。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 虾壳!