Kibana6.0 常用增删改查命令(一)

@羲凡——只为了更好的活着

Kibana6.0 常用增删改查命令(一)

1.查看基本状态

查看集群健康状态

GET /_cat/health?v

查看集群节点列表

GET /_cat/nodes?v

查看所有的索引

GET /_cat/indices?v
2.基本示例

创建索引并指定分片数量和复本数,且自定义mapping。dynamic是针对现有的索引中没有的字段的控制,“strict”表示报错,“true”表示可以插入,“false”表示忽略

PUT /aaron_index
{
  "settings": {
    "number_of_shards" : 1 ,
    "number_of_replicas" : 0
  },
  "mappings": {
    "aaron_type":{
      "dynamic":"strict",
      "properties":{
        "id":{"type": "integer"},
        "name":{"type": "text","analyzer":"standard"},
        "birthday":{"type": "date","index":false},
        "salary":{"type": "double"},
        "hobby":{"type": "text","analyzer":"ik_max_word"}
      }
    }
  }
}

自定义map类型

PUT /aaron_index/aaron_type/_mapping
{
  "properties": {
    "id":{"type": "integer"},
    "name":{"type": "text","analyzer":"standard"},
    "birthday":{"type": "date","index":false},
    "salary":{"type": "double"},
    "hobby":{"type": "text","analyzer":"ik_max_word"}
  }
}

查看map类型

GET /_mapping/aaron_type

批量插入数据

POST /aaron_index/aaron_type/_bulk
{ "index": { "_id":1}}
{ "name": "张辽","birthday":"1992-02-27","salary":88888.88,"hobby":"我喜欢跑步,喝酒和打仗"}
{ "index": { "_id": 2}}
{ "name": "曹操","birthday":"1991-01-24","salary":78888.88,"hobby":"我喜欢唱歌,喝酒和打仗"}
{ "index": { "_id": 3}}
{ "name": "夏侯惇","birthday":"1992-03-30","salary":68888.88,"hobby":"我喜欢跑步和打仗"}
{ "index": { "_id": 4}}
{ "name": "夏侯渊","birthday":"1992-03-01","salary":58888.88,"hobby":"我喜欢打仗"}
{ "index": { "_id": 8}}
{ "name": "羲凡","birthday":"1992-03-30","salary":88888.88,"hobby":"我喜欢喝酒"}

查询全量

GET /aaron_index/aaron_type/_search
{
  "query": {
    "match_all": {}
  }
}

查询张辽信息

GET /aaron_index/aaron_type/_search
{
  "query": {
    "match": {
      "name":"张辽"
    }
  }
}

查询薪资为88888.88的人(数字和日期类型的不能进行分词

GET /aaron_index/aaron_type/_search?q=salary:88888.88

查询喜欢喝酒的人

GET /aaron_index/aaron_type/_search
{
  "query": {
    "match": {
      "hobby":"喝酒"
    }
  }
}

删除索引

DELETE /aaron_index

====================================================================

@羲凡——只为了更好的活着

若对博客中有任何问题,欢迎留言交流

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值