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

curl 访问es 常用的命令

root3年前 (2022-07-05)数据库986

查询有哪些索引

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不可用,删除ib_logfile0和ib_logfile1恢复

mysql安装在虚拟机中,公司突然断电导致mysql启动失败查看mysql的error日志2021-05-19T06:44:51.993300Z 0 [ERROR] InnoDB: Ignoring the redo log due to...

dataX:超强的数据库数据互导工具

安装下载安装包http://datax-opensource.oss-cn-hangzhou.aliyuncs.com/datax.tar.gz 然后解压进入解压后文件的./bin自检命令python  datax.py ../j...

被Navicat坑哭的日常,版本问题

mysql5.7DROP TABLE IF EXISTS `xxx_copy1`;CREATE TABLE `xxx_copy1`  (  `id` int(11) UNSIGNED NOT NULL AUTO_INCR...

mysql 重置表

truncate table 表名...

mysql数据导入es

将mysql数据取出放到elasticsearch中from datetime import datetime from elasticsearch import Elastic...

clickhouse 搭建

通过docker 部署clickhousedocker-compose文件内容如下:services:     ipwave-clickhouse:     ...