コード例 #1
0
def search(alias, doc_type):
    """Execute the given search query."""
    query = request.get_json() or {
        'query': {
            'match_all': {}
        }
    }

    hits = es.search(index=alias, doc_type=doc_type, body=query)['hits']

    return flask.jsonify(hits)
コード例 #2
0
def list_documents(alias, doc_type):
    """Return all documents of the given type."""
    # TODO: Blacklist shard info instead?
    hits = es.search(alias, doc_type)['hits']
    return flask.jsonify(hits)