官网:https://elasticsearch-py.readthedocs.io/en/master/api.html

官网:https://github.com/elastic/elasticsearch-py/tree/master/elasticsearch/client

官网:https://elasticsearch-dsl.readthedocs.io/en/latest/api.html

from elasticsearch_dsl import connections, Search
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import * es_object = Elasticsearch(['url:9200'], sniffer_timeout=60, timeout=30)
# 获取es中所有的索引
# 返回类型为字典,只返回索引名
es_object.cat.indices(format='json',h='index')
# 查询多个索引
es_s_object = Search(using = es_object, index = ['log-2018-07-31','log-2018-07-30','log-2018-07-29'])
# 查询一个索引
es_s_object = Search(using = es_object, index = 'log-2018-07-31')
# 条件查询1
es_r_object = es_s_object.filter("range", timestamp={"gte": 1532879975, "lt":1532880095})
# 条件查询2
es_r_object = es_r_object.filter("term", title = '')
# 结果转换为字典
es_r_dict = es_r_object.execute().to_dict()

【Python】Elasticsearch和elasticsearch_dsl的更多相关文章

  1. Python Elasticsearch api,组合过滤器,term过滤器,正则查询 ,match查询,获取最近一小时的数据

    Python Elasticsearch api   描述:ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.下 ...

  2. Python Elasticsearch api

    描述:ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.下面介绍了利用Python API接口进行数据查询,方便 ...

  3. Python Elasticsearch批量操作客户端

    基于Python实现的Elasticsearch批量操作客户端 by:授客 QQ:1033553122   1. 代码用途 1 2. 测试环境 1 3. 使用方法 1 3.1 配置ES服务器信息 1 ...

  4. python elasticsearch 批量写入数据

    from elasticsearch import Elasticsearch from elasticsearch import helpers import pymysql import time ...

  5. Python Elasticsearch

    以下所用版本为Elasticsearch 7.2.0 1.安装 pip3 install elasticsearch -i https://pypi.tuna.tsinghua.edu.cn/simp ...

  6. 轻量级OLAP(二):Hive + Elasticsearch

    1. 引言 在做OLAP数据分析时,常常会遇到过滤分析需求,比如:除去只有性别.常驻地标签的用户,计算广告媒体上的覆盖UV.OLAP解决方案Kylin不支持复杂数据类型(array.struct.ma ...

  7. python | Elasticsearch-dsl常用方法总结(join为案例)

    Elasticsearch DSL是一个高级库,其目的是帮助编写和运行针对Elasticsearch的查询.它建立在官方低级客户端(elasticsearch-py)之上. 它提供了一种更方便和习惯的 ...

  8. Elasticserch与Elasticsearch_dsl用法

    Elasticserch与Elasticsearch_dsl用法 Elasticsearch_dsl::https://elasticsearch-dsl.readthedocs.io/en/late ...

  9. elasticsearch查询之大数据集分页性能测试

    一.测试环境 python 3.7 elasticsearch 6.8 elasticsearch-dsl 7 安装elasticsearch-dsl pip install elasticsearc ...

随机推荐

  1. VM克隆centos7虚拟机并配置网络

    笔者这里有个配置好网络的centos7系统,下面将根据这个centos7克隆出一个centos7系统,并配置好网络 1.右键虚拟机克隆 2.选择创建完整克隆 3.克隆机的命名,点击完成 4.可看到这里 ...

  2. MySQL Hardware--网络测试

    使用Ping测试丢包 ## ping测试 ## -c 100表示100次 ping -c 100 192.168.1.2 输出结果: ping -c 100 192.168.1.2 PING 192. ...

  3. Hot Chocolate 一个.net 平台的graphql 框架

    在看昨天发布的新版技术雷达中,看到了一个.net 的graphql 框架Hot Chocolate 还是比较激动,尽管好久不搞 .net 了,但是这个框架还是值得看看的,后边学习下 参考资料 http ...

  4. PHP之Trait详解

    php从以前到现在一直都是单继承的语言,无法同时从两个基类中继承属性和方法,为了解决这个问题,php出了Trait这个特性 用法:通过在类中使用use 关键字,声明要组合的Trait名称,具体的Tra ...

  5. innobackupex一些常用备份选项

    指定数据库备份[root@node1]# innobackupex --defaults-file=/data/3306/my.cnf --user=root --password=password ...

  6. Linux col命令详解

    Linux col命令 Linux col命令用于过滤控制字符. 在许多UNIX说明文件里,都有RLF控制字符.当我们运用shell特殊字符">"和">> ...

  7. my sql无法删除数据库

    mysql有时候会无法删除数据库,可以通过 1.select @@datadir 查询到文件目录 'C:\\ProgramData\\MySQL\\MySQL Server 5.7\\Data\\' ...

  8. JDK安装教程

    打开我的电脑,在D盘中新建一个文件夹,名字为develop 进入develop,创建一个新文件夹,名字叫做jdk 双击JDK的安装包, .4.出如图所示的框,选择下一步 .5.更改安装路径,选择更改 ...

  9. SSHD启动失败,错误码255

    查看/etc/ssh/sshd_config 发现,Listen Address并不是我想要的ip,将其注释掉 sshd restart,结果返回 Permission denied (publick ...

  10. 导出dmp

    如果有空表都需要导出执行 select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows= ...