How to get a distinct list of keys of a dictionary field

Hi, I have a field, which is a dictionary stored inside the _source as follows:

"dict_field": {
"key1": value,
"key2": value,
"key3": value,

I don't know all the possible keys, and I'd like to write an es query to return a list of the distinct keys. I tried the standard terms query, but it didn't work. Does anyone know how to do this?

Thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.