日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

【Python】Elasticsearch和elasticsearch_dsl

發(fā)布時間:2023/12/20 python 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Python】Elasticsearch和elasticsearch_dsl 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
【Python】Elasticsearch和elasticsearch_dsl

官網(wǎng):https://elasticsearch-py.readthedocs.io/en/master/api.html

官網(wǎng):https://github.com/elastic/elasticsearch-py/tree/master/elasticsearch/client

官網(wǎng):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 = '12345') # 結(jié)果轉(zhuǎn)換為字典 es_r_dict = es_r_object.execute().to_dict()

?

posted on 2018-07-31 17:07 poorX 閱讀(...) 評論(...) 編輯 收藏

轉(zhuǎn)載于:https://www.cnblogs.com/jiangxu67/p/9396949.html

總結(jié)

以上是生活随笔為你收集整理的【Python】Elasticsearch和elasticsearch_dsl的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。