Kibana操作ES基础

废话少说,开干!!!!!!!!!!!!截图更清晰,复制在下面

复制代码
#================库操作===================

#创建索引【相当于数据库的库】
PUT /first_index

#获取索引【相当于数据库的库】
GET first_index

#删除索引【相当于数据库的库】
DELETE /first_index


#================表操作===================

#创建类型【相当于数据库的表,即创建表字段】
POST /first_index/first_type
{
  "properties" : {
    "id" : {"type" : "long"},
    "username" : {"type" : "text"},
    "password" : {"type" : "text"},
    "age" : {"type" : "integer"}
  }
}

#获取类型【相当于数据库的表,添加表字段name,索引一旦创建就不能更改,如果更改导出数据,创建索引,导入数据】
POST /first_index/first_type
{
  "properties" : {
    "id" : {"type" : "long"},
    "name" : {"type" : "text"},
    "password" : {"type" : "text"},
    "age" : {"type" : "integer"}
  }
}


#================行操作===================

#获取行内容
GET /first_index/first_type/10/_source

#添加和修改【如果有id为10的数据就修改,如果没有就添加】
POST /first_index/first_type/10
{
    "id" : 23,
    "username" :"lisi" ,
    "password" : "666",
    "age" : 11
}

POST /first_index/first_type/11
{
    "id" : 11,
    "username" :"111" ,
    "password" : "111",
    "age" : 11
}

POST /first_index/first_type/12
{
    "id" : 11,
    "username" :"111" ,
    "password" : "111",
    "age" : 5
}

#删除行数据
DELETE /first_index/first_type/11



#================常用命令===================


#获取所有的index【相当于数据库的库】,返回json格式
GET /_cat/indices?format=json

#获取所有的index【相当于数据库的库】,返回列表
GET /_cat/indices?

#获取所有的index【相当于数据库的表及表字段属性】
GET first_index

#获取所有的index【相当于表的行数据】
GET /first_index/_search
{
  "query": {
    "match_all": {}
  }
}


#查询username是lisi的数据,不是模糊查询
GET /first_index/_search
{
  "size": 2,
  "query": {
    "match": {
      "username":"lisi"
    }
  }
}

#查询username包含li的数据,是模糊查询
GET /first_index/_search
{
  "query": {
    "query_string": {
      "fields": ["username"],
      "query": "*li*"
    }
  }
}

#查询age大于6的数据
POST /first_index/_search
{
  "query": {
    "range": {
      "age": {
        "gt": 6
      }
    }
  }
}
相关推荐
guwentian9 分钟前
Git Worktree 实战:用并行多 Agent 把开发提速 N 倍
大数据·git·elasticsearch·wroktree
Elastic 中国社区官方博客5 小时前
Elasticsearch:使用 AI Agent 来创建 workflow
大数据·运维·人工智能·elasticsearch·搜索引擎·自动化·全文检索
阿里云大数据AI技术5 小时前
AI Search+ES 9.4.X最佳实践:“更快、更准、更安全的企业级搜索引擎”"为AI Agent提供坚实底座”
人工智能·elasticsearch·agent
Elasticsearch9 小时前
Elastic 社区通讯 — 2026 年 8 月
elasticsearch
lsh曙光10 小时前
ES数据备份与恢复
大数据·elasticsearch·搜索引擎
Shawn Dev13 小时前
MySQL Binlog 数据误删除恢复完全指南
数据库·mysql·elasticsearch
Elastic 中国社区官方博客15 小时前
用两行 JSON 替换你的 ILM 策略:数据流生命周期新增冻结层支持
大数据·运维·elasticsearch·搜索引擎·架构·全文检索
小张同学a.15 小时前
ELK企业级日志分析平台3——ES数据备份 & 集群监控 & ELFK+Kafka 架构部署
linux·运维·elk·elasticsearch·架构·kafka·filebeat
lsh曙光1 天前
ELK日志平台--elasticsearch部署
elasticsearch
Elasticsearch1 天前
训练量仅占 0.35%,竞争力却达到 100%:jina-embeddings-v5-omni 背后的冻结塔架构
elasticsearch