ElasticSearch 查询构建器 ElasticQuery

码农软件 · 软件分类 · 搜索引擎 · 2019-08-26 12:13:42

软件介绍

ElasticQuery 是用于 ElasticSearch 的简单查询构建器。可使用 metod 方法调用和相应的参数来生成查询、过滤和聚合对象。输出的 dict/json 可直接传递给 ES。

示例代码:

from elasticsearch import Elasticsearch
from elasticquery import ElasticQuery, Filter, Query


# Create a query with our ES index details
q = ElasticQuery(
    es=Elasticsearch(),
    index='mapping_test',
    doc_type='doc_mapping'
)

# Query it!
q.query(
    Query.terms('my_field', ['my', 'terms'])
)

# Aggregate it!
q.aggregate(
    Aggregate.sum('my_agg', 'my_field')
)

# Print the query, then run on ES and print it's output
print q.json(indent=4)
print q.get()

本文地址:https://www.codercto.com/soft/d/13205.html

Ethnography and Virtual Worlds

Ethnography and Virtual Worlds

Tom Boellstorff、Bonnie Nardi、Celia Pearce、T. L. Taylor / Princeton University Press / 2012-9-16 / GBP 21.00

"Ethnography and Virtual Worlds" is the only book of its kind - a concise, comprehensive, and practical guide for students, teachers, designers, and scholars interested in using ethnographic methods t......一起来看看 《Ethnography and Virtual Worlds》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具