# How can I get all key-value pairs for the object with Painless?

**URL:** <https://discuss.elastic.co/t/how-can-i-get-all-key-value-pairs-for-the-object-with-painless/169263>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [February 20, 2019, 4:56pm UTC](https://discuss.elastic.co/t/how-can-i-get-all-key-value-pairs-for-the-object-with-painless/169263 "2019-02-20T16:56:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![e328d7523d137d40a2ab](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@e328d7523d137d40a2ab](https://discuss.elastic.co/u/e328d7523d137d40a2ab)\
**Post date:** [February 20, 2019, 4:56pm UTC](https://discuss.elastic.co/t/how-can-i-get-all-key-value-pairs-for-the-object-with-painless/169263/1 "2019-02-20T16:56:08Z")

</div>

So, I can get access to object values this way:

```
doc['field.KEY'].value

```

But how can I get all key-value pairs for the object? Like `field.entrySet()` ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 20, 2019, 4:56pm UTC](https://discuss.elastic.co/t/how-can-i-get-all-key-value-pairs-for-the-object-with-painless/169263/2 "2019-03-20T16:56:11Z")

</div>

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