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

Ruby for Rails

Ruby for Rails

David Black / Manning Publications / 2006-05-11 / USD 44.95

What's Inside * How Ruby and Rails work, separately and together * Extensive Ruby language tutorial * Ruby techniques for Rails applications * Explore the Rails framework source code A new level of pr......一起来看看 《Ruby for Rails》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换