首页 > 其他分享 >elasticsearch查询

elasticsearch查询

时间:2023-06-07 09:47:37浏览次数:36  
标签:search GET 查询 elasticsearch query match

elasticsearch查询,elasticsearch常见查询,elasticsearch命令

elasticsearch常用命令

1、查询索引

GET _cat/indices

 2、查看es磁盘使用情况

GET _cat/allocation?v&pretty

 3、查看es分词情况

GET _analyze
{
  "text": "中国"
}

elasticsearch常用查询

查询基本语法,所有的查询都遵循:

GET /索引库名/_search
{
  "query": {
    "查询类型": {
      "查询条件": "条件值"
    }
  }
}

根据单个字段查询

GET /indexName/_search
{
  "query": {
    "match": {
      "FIELD": "TEXT"
    }
  }
}

 

根据多个字段查询

GET /indexName/_search
{
  "query": {
    "multi_match": {
      "query": "TEXT",
      "fields": ["FIELD1", " FIELD12"]
    }
  }
}

match和multi_match的区别是什么?

  • match:根据一个字段查询
  • multi_match:根据多个字段查询,参与查询字段越多,查询性能越差

根据多个id查询

GET vehicle_pass/_search
{
  "query": {
    "ids": {
      "values": [
        "eVZ6k4gB5D3TP6XJGiS4"
        ]
    }
  }
}

参考:https://blog.csdn.net/m0_37922192/article/details/121449124

标签:search,GET,查询,elasticsearch,query,match
From: https://www.cnblogs.com/liubaihui/p/17462465.html

相关文章

  • Gorm - sql查询某个字段为空时赋默认值
    场景:查询时报错err{"error":"sql:Scanerroroncolumnindex0,name\"mobile\":convertingNULLtostringisunsupported"}总结:根据项目需要,在数据库查询时,可能需要对查询结果进行封装,为避免前端抛出空指针异常(NullPointException),对于没有值的字段也不能......
  • MYSQL联合查询
       ......
  • MYSQL查询
         子查询   分页查询 ......
  • MYSQL分页查询
          ......
  • SQL 跨库查询
    --1.openrowset--查询select*fromopenrowset('SQLOLEDB','sql服务器名';'用户名';'密码',数据库名.dbo.表名)--生成本地表select*into表fromopenrowset('SQLOLEDB','sql服务器名';'用户名';'密码&......
  • Elasticsearch专题精讲—— REST APIs —— Document APIs —— Update By Query API
    RESTAPIs——DocumentAPIs—— UpdateByQueryAPIhttps://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-update-by-query.html#docs-update-by-queryUpdatesdocumentsthatmatchthespecifiedquery.Ifnoqueryisspecified,performsanupdateo......
  • 河北查询4/18
    1、顶部为LOGO区,主要展示科技技术情报研究院的LOGO,并用蓝黑色显示科技政策查询系统。2、第二部分为多条件查询区,主要包括政策图解(按钮式超级链接),查询条件包括政策名称、政策文号、发文机构、全文检索四个查询条件,可以根据四个条件进行综合查询。3、第三部分为左侧科技政策分类树......
  • Elasticsearch专题精讲—— REST APIs —— Document APIs —— Update API
    RESTAPIs——DocumentAPIs——UpdateAPIhttps://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-update.htmlUpdatesadocumentusingthespecifiedscript.使用指定的脚本更新文档。1、Request(请求)https://www......
  • 分布式搜索elasticsearch集群监控工具bigdesk
    bigdesk是elasticsearch的一个集群监控工具,可以通过它来查看es集群的各种状态,如:cpu、内存使用情况,索引数据、搜索情况,http连接数等。项目git地址: https://github.com/lukas-vlcek/bigdesk。和head一样,它也是个独立的网页程序,使用方式和head一样。插件安装运行......
  • mybatis查询语句专题
    前言:打包⽅式:jar 引⼊依赖:mysql驱动依赖、mybatis依赖、logback依赖、junit依赖。 引⼊配置⽂件:jdbc.properties、mybatis-config.xml、logback.xml 创建pojo类:Car 创建Mapper接⼝:CarMapper 创建Mapper接⼝对应的映射⽂件:com/powernode/mybatis/mapper/CarMapper.xml 创建单......