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

curl 访问es 常用的命令

root2年前 (2022-07-05)数据库422

查询有哪些索引

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工具的使用

没有最新的文章了...

相关文章

centos7 快速搭建 mysql

https://blog.csdn.net/qq_36582604/article/details/80526287...

clickhouse 分区、分片简单理解

clickhouse 分区、分片简单理解

分区是表的分区,具体的DDL操作关键词是 PARTITION BY,指的是一个表按照某一列数据(比如日期)进行分区,对应到最终的结果就是不同分区的数据会写入不同的文件中。分片复用了数据库的分区,相当于在原有的分区下,作为第二层分区...

postgresql 的安装使用

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

mysql 主键 用int还是long 还是char?有什么区别

char是定长0-255 bytes longtext是0-4 294 967 295 bytes 极大文本数据longblob是二进制形式的极大文本数据...

clickhouse基本数据类型

整型有符号整型Int8 - [-128 : 127]Int16 - [-32768 : 32767]Int32 - [-2147483648 : 2147483647]Int64 - [-9223372036854775808 : 9223...

mysql alter、index的操作

删除字段alter table user drop name;添加字段alter table user add address varchar(255...