elasticsearch-dsl,Python,elasticsearch Dsl" /> elasticsearch-dsl,Python,elasticsearch Dsl" />

Python 在elasticsearch dsl中使用包含“@”(@时间戳)的字段名

Python 在elasticsearch dsl中使用包含“@”(@时间戳)的字段名,python,elasticsearch-dsl,Python,elasticsearch Dsl,我有一种感觉,我的问题肯定有一个微不足道的答案,但有几个 几个小时的谷歌搜索和python教程,我仍然被困在那里 我的字段名通常包含@字符,即@时间戳 python将@用于修饰函数 如何在elasticsearch dsl中引用这些字段名? 我正在使用python 3.6.2 resp = s.execute() for hit in resp: print(hit.response_code) print(hit.@timestamp) 当然,我尝试了转义和引用。你可以随时

我有一种感觉,我的问题肯定有一个微不足道的答案,但有几个 几个小时的谷歌搜索和python教程,我仍然被困在那里

我的字段名通常包含@字符,即@时间戳 python将@用于修饰函数

如何在elasticsearch dsl中引用这些字段名? 我正在使用python 3.6.2

resp = s.execute()

for hit in resp:
    print(hit.response_code)
    print(hit.@timestamp)

当然,我尝试了转义和引用。

你可以随时使用hit['@timestamp']或getattrhit,'@timestamp'

Thx很多,我知道我遗漏了一些琐碎的东西。你好,彼得