Printing out all fields of an entry. without knowing what they are.
See original GitHub issueHello again friend! So I’m using the dsl library and i want to know if i can print out an entire entry from the response given. I’m using the following script to search a test instance.
import elasticsearch
from elasticsearch_dsl import Search, Q
from datetime import datetime
es = elasticsearch.Elasticsearch([{u'host': u'himanshu.addteq.com', u'port': b'9200'}])
es.index(index="david", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()})
s = Search(using=es, index= "_all")
response = s.execute()
for hit in response:
print hit
and I get this output.
<Result(logstash-2014.12.30/apache/F60rG4hiS42FKL-cx6rnTA): {u'tags': [u'_grokparsefailure'], u'@version': u'1', u'@time...}>
<Result(logstash-2011.08.30/apache/L_CO1AOSTnuvjiBKMl8T_g): {u'ident': u'-', u'referrer': u'"-"', u'@version': u'1', u'@...}>
<Result(logstash-2011.08.30/apache/YEXRqjFjSuOKE6cwLLg0Yw): {u'ident': u'-', u'referrer': u'"-"', u'@version': u'1', u'@...}>
<Result(logstash-2011.08.30/apache/l6QsZNmKQo-s9ZBOftlW4w): {u'ident': u'-', u'referrer': u'"-"', u'@version': u'1', u'@...}>
<Result(logstash-2011.08.30/apache/ONhdAJVhSJC5rfnKAvB78g): {u'ident': u'-', u'referrer': u'"-"', u'@version': u'1', u'@...}>
...
<Result(logstash-2011.08.30/apache/MeGfj_LTSQWc6D8XugalAg): {u'ident': u'-', u'referrer': u'"http://www.semicomplete.com...}>
I can print the individual fields, like hit.host
for example, but printing hit itself does not give me the entire set, I am only given these errors. Thanks again!
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Printing the values of an instantiated structure without using ...
Any help would be appreciated. The only information I know it is that all the fields are C++ strings. c++ · string ·...
Read more >Print each field of CSV on newline without knowing number of ...
I 'm trying to figure out how to do this on a list that's much longer where I wouldn't want to specify every...
Read more >Has the record been printed? - Allen Browne
It needs more than just a yes/no field to mark the record as printed or not. A better solution is to mark the...
Read more >Items List won't print out all columns. - SAP Community
Hi. Go to Tools>query > query generator. Select OITM table then you can see all the fields. You can select the field you...
Read more >Repeat specific rows or columns on every printed page
If a worksheet spans more than one printed page, you can label data by adding row and column headings that will appear on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see, is there any way to know if the response were empty?? this will re-create that issue
@ChristopherRabotin just adding that you don’t need to work with the datetimes as text -
elasticsearch-py
supportsdatetime
objects and will correctly serialize them when sending data to elasticsearch.