elasticserach基本使用

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

image.png


一、查看elasticsearch信息
ide

GET /     spa

image.png


二、建立索引3d

PUT /testblog

image.png


三、獲取所有索引索引

GET _cat/indices?vip

image.png


四、向索引中插入數據ci

PUT /test/info/1it

{ast

  "name":"zhangsan",

  "age":20

}


image.png


五、獲取插入索引的信息

GET /test/info/1

image.png


六、獲取單條索引的所有信息

GET /test/_search?q=*

image.png


七、刪除索引中的數據

DELETE /test/info/1

image.png


八、更改某一類型的數據

spacer.gifimage.png

image.png


九、批量更改數據

POST /test/_update_by_query

{

  "script": {

    "source" : "ctx._source['age']=26"

  },

  "query":{

    "match_all": {}

  }

}

image.png

查詢全部數據,age已經變動爲26

GET /test/_search?q=*

image.png



十、爲索引增長字段

POST /test/_update_by_query

{

  "script": {

    "source" : "ctx._source['city']='beijing'"

  },

  "query":{

    "match_all": {}

  }

}

image.png

image.png

相關文章
相關標籤/搜索