ELK实践(三):ElasticSearch 索引查询使用指南
- 我们通常用用_cat API检测集群是否健康。 确保9200端口号可用:
curl -u elastic:changeme 'localhost:9200/_cluster/health?pretty'
- 创建索引
现在我们创建一个名为“customer”的索引,然后再查看所有的索引:
curl -u elastic:changeme -XPUT 'localhost:9200/customer?pretty'
curl -u elastic:changeme 'http://192.168.43.5:9200/_cat/indices?v'
- 插入和获取
现在我么插入一些数据到集群索引。我们必须给ES指定所以的类型。如下语句:"external" type, ID:1:
主体为JSON格式的语句: { "name": "John Doe" }
参考链接:
手册:http://doc.codingdict.com/elasticsearch/8/#delete-an-index