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

相关文章
相关标签/搜索