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
      }
    }
  }
}
相关推荐
Elastic 中国社区官方博客8 小时前
Elasticsearch Open Inference API 增加了对 Jina AI 嵌入和 Rerank 模型的支持
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索·jina
隔壁老王1568 小时前
mysql实时同步到es
数据库·mysql·elasticsearch
SunnyRivers10 小时前
关于ES中text类型时间字段范围查询的结构化解决方案
elasticsearch·时间·text·范围查询
API_technology11 小时前
电商搜索API的Elasticsearch优化策略
大数据·elasticsearch·搜索引擎
stone.eye14 小时前
阿里云通过docker安装skywalking及elasticsearch操作流程
elasticsearch·阿里云·docker·skywalking
fruge18 小时前
git上传 项目 把node_modules也上传至仓库了,在文件.gitignore 中忽略node_modules 依然不行
大数据·git·elasticsearch
飞火流星020271 天前
ElasticSearch公共方法封装
elasticsearch·搜索引擎·es鉴权·es代理访问·es公共方法封装·es集群访问·判断es索引是否存在
vvvae12341 天前
Elasticsearch实战应用:从“搜索小白”到“数据侦探”的进阶之路
elasticsearch
yinbp1 天前
bboss v7.3.5来袭!新增异地灾备机制和Kerberos认证机制,助力企业数据安全
大数据·elasticsearch·微服务·etl·restclient·bboss
m0_748255021 天前
Springboot中使用Elasticsearch(部署+使用+讲解 最完整)
spring boot·elasticsearch·jenkins