上一章讲述了ELK的搭建,本章主要为elasticsearch的基本使用

1、查看elasticsearch信息
GET /

2、创建索引
PUT /test

3、获取全部索引
GET _cat/indices?v

4、向索引中插入数据
PUT /test/info/1
{
"name":"zhangsan",
"age":20
}

5、获取插入索引的信息
GET /test/info/1

6、获取单条索引的全部信息
GET /test/_search?q=*

7、删除索引中的数据
DELETE /test/info/1

8、更改某一类型的数据



9、批量更改数据
POST /test/_update_by_query
{
"script": {
"source" : "ctx._source['age']=26"
},
"query":{
"match_all": {}
}
}
、
查询所有数据,age已经变更为26
GET /test/_search?q=*

10、为索引增加字段
POST /test/_update_by_query
{
"script": {
"source" : "ctx._source['city']='beijing'"
},
"query":{
"match_all": {}
}
}


















