Python ElasticSearch DSL Truncating Results -
i trying utilize elasticsearch dsl library in python seem getting kind of truncated results/metadata instead of document/response object. sanitized query below:
from elasticsearch_dsl import search, q, f elasticsearch_dsl.query import multimatch elasticsearch import elasticsearch import requests import json client = elasticsearch("") s = search().using(client).query("match", id="1") response = s.execute() test_response = response.json() which gives error:
attributeerror: 'response' object has no attribute 'json' i hoping use newer dsl keep things less verbose. has encountered or have tips. appreciated!
the result of execute() parsed json (the structure same response http api):
print(response.hits.total) you can iterate on results follows (documentation):
for h in response: print(h.title, h.body)
Comments
Post a Comment