We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all,
My query specify the filter_path=hits.hits.<some_fields>, response will be an empty json object like the following if no documents matched:
curl http://127.0.0.1:9200/twitter/_search\?filter_path\=hits.hits._id {}
And I use high-level client to execute this query, it will raise a KeyError instead.
from elasticsearch import Elasticsearch from elasticsearch_dsl import Search client = Elasticsearch('http://localhost:9200') s = Search(using=client, index='twitter').params(filter_path='hits.hits._id') response = s.execute(ignore_cache=True) print response.hits ===================== Traceback (most recent call last): File "/Users/brick/Workspaces/python/elasticsearch-py-demo/demo.py", line 8, in <module> print response.hits File "/Users/brick/.venv/elasticsearch-py-demo/lib/python2.7/site-packages/elasticsearch_dsl/response/__init__.py", line 64, in hits h = self._d_["hits"] KeyError: 'hits'
I think it would use h.get("hits", []) instead of h["hits"]:
h.get("hits", [])
h["hits"]
elasticsearch-dsl-py/elasticsearch_dsl/response/__init__.py
Line 67 in dd01010
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi all,
My query specify the filter_path=hits.hits.<some_fields>, response will be an empty json object like the following if no documents matched:
And I use high-level client to execute this query, it will raise a KeyError instead.
I think it would use
h.get("hits", [])
instead ofh["hits"]
:elasticsearch-dsl-py/elasticsearch_dsl/response/__init__.py
Line 67 in dd01010
The text was updated successfully, but these errors were encountered: