ITPub博客

首页 > IT基础架构 > > ElasticSearch基本用法(kibana Devtools 基本语法)

ElasticSearch基本用法(kibana Devtools 基本语法)

作者:格伯纳 时间:2020-05-29 11:50:48 0 删除 编辑

查询某一个索引下的所有数据:

GET cms_test/_search

查询某一个索引的模板信息:

GET cms_test/_settings

GET cms_test/_mapping

查询es服务下的所有别名:

GET _alias

查询指定查询条件的数据:

查询age=50且sex!=女的数据,分页每页5条数据

GET cms_test2/_search

{

"query": {

"bool": {

"must":{"match":{"age":"50"}},

"must_not": {"match":{"sex":"女"}}

}

},

"from" : 0,

"size" : 5

}

查询数据排序:

根据Id降序排序

GET cms_test/_search

{

"sort":[

{

"id":{"order":"asc"}

}

]

}

在索引库添加指定的数据:

指定添加数据的_id不指定时,默认自动生成uuid

PUT cms_test4/_doc/3

{

"name":"linda",

"country":"加拿大",

"sex":"woman",

"city":"温哥华",

"id":"3"

}

编辑mapping信息:

PUT cms_test/_mapping/_doc

{

"properties": {

"aaa": {

"type": "text"

},

"siteId": {

"type": "keyword"

},

"userId": {

"type": "keyword"

},

"userIp": {

"type": "keyword"

},

"userName": {

"type": "keyword"

},

"series_tx_id": {

"type": "text",

"analyzer": "keyword"

}

}

}

编辑settings信息:

PUT cms_test/_settings

{

"index" : {

"number_of_replicas":3

}

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31509949/viewspace-3131896/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
管理员

注册时间:2018-03-30

  • 博文量
    2383
  • 访问量
    984262