当前位置:首页 > 数据库 > 正文内容

curl 访问es 常用的命令

root4年前 (2022-07-05)数据库1438

查询有哪些索引

curl -X GET 'http://10.0.0.143:8200/_cat/indices'

查询索引的别名

curl  -XGET 'http://127.0.0.1:8200/index_v1/_alias'

根据查询语句查询数据

curl  -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1}'


根据查询语句查询数据  要求携带keyword 关键字 es的分词问题

curl  -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time.keyword": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1}'


根据查询语句查询数据 查询的结果的总数即total 是eq 一个确定的值

curl  -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1,"track_total_hits":true}'

"track_total_hits":true 这个参数要求查询的结果总数不是一个估计值


参考文档

查询日期不准,分词问题参考文档



扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=230

分享给朋友:
返回列表

上一篇:es 迁移数据elasticdump工具的使用

没有最新的文章了...

相关文章

mysql启动失败 日志InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 3485

mysql报错Ignoring the redo log due to missing MLOG_CHECKPOINT betweenmysql版本:5.7.33系统版本:ubuntu16.04由于电脑突然关闭,跑在VMware里面的mys...

mysql 导出csv格式数据

mysql -e "select * from newsdb.t_hk_stock_news where id <100  ...

postgresql 的安装使用

安装centos系统 9.6版本# Install the repository RPMsudo yum install -y https://download.postgresql.org/pub/repos/yum/repor...

centos7 安装mysql

centos7 安装mysql

下载rpm包wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 安裝包仓库yum -y install * 或者yum -...

postgresql修改数据存储位置

postgresql修改数据存储位置

最近公司提供了一台新的服务器,同时有一个盘是ssd。同时为了测试postgresql的性能,将数据放置到ssd上系统centos7.9 数据库postgresql-9.6首先停掉数据库systemctl stop pos...

清空postgresql的缓存

系统:centos,版本:postgresql-9.6因为要测试postgresql的性能,当多次查询的时候查询结果会因为缓存用时很短,不能模拟出现实使用的场景。因此需要清除缓存。首先stop掉postgresqlsystemctl sto...