1

I'm using elasticsearch-dsl-py to extract data from elasticsearch.

I want to save the value of the @timestamp field (hits.hits._source.@timestamp). But I have no clue how to deal with the fact that the @ character is not allowed in Python.

How do I get the value from @timestamp? This does not work:

h = response.hits[0]
print(h.@timestamp)

Thanks

Scott Skiles
  • 3,647
  • 6
  • 40
  • 64
user3024742
  • 63
  • 2
  • 11

1 Answers1

2

In that case you can access that field as follows:

h = response.hits[0]
print h['@timestamp']
moliware
  • 10,160
  • 3
  • 37
  • 47