# Fetch the array of "docker.container.id" (all the docker container ids) from the docker metrics

**URL:** <https://discuss.elastic.co/t/fetch-the-array-of-docker-container-id-all-the-docker-container-ids-from-the-docker-metrics/201342>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [September 27, 2019, 6:23am UTC](https://discuss.elastic.co/t/fetch-the-array-of-docker-container-id-all-the-docker-container-ids-from-the-docker-metrics/201342 "2019-09-27T06:23:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yashvardhan\_Kukreja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yashvardhan_kukreja/32/54990_2.png) [@Yashvardhan\_Kukreja](https://discuss.elastic.co/u/Yashvardhan_Kukreja)\
**Post date:** [September 27, 2019, 6:23am UTC](https://discuss.elastic.co/t/fetch-the-array-of-docker-container-id-all-the-docker-container-ids-from-the-docker-metrics/201342/1 "2019-09-27T06:23:49Z")

</div>

So, I am using metricbeat to fetch my docker related logs and metrics.  
So, that output of the Elasticsearch query looks something like this :  
{  
...  
..  
"hits": [  
{  
"docker" : {  
"container" : {  
**"id" : "b1234",**  
"name" : "sleepy\_elion",  
"image" : "node"  
}  
}  
},  
{  
"docker" : {  
"container" : {  
**"id" : "a3453",**  
"name" : "something\_elion",  
"image" : "node"  
}  
}  
}  
]  
}

* * *

Now, what I want to know is:  
Is there any "aggregation" or something else which can look into the "docker.container.id" of every "hit" in "hits" array and in the output create a field, say, "all\_container\_ids" which will have all the unique container ids, like a set of all the "docker.container.id"

So, it might look something like this in this situation

"all\_container\_ids" : [  
"b1234",  
"a3453"  
]

---

<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:** [October 25, 2019, 6:23am UTC](https://discuss.elastic.co/t/fetch-the-array-of-docker-container-id-all-the-docker-container-ids-from-the-docker-metrics/201342/2 "2019-10-25T06:23:53Z")

</div>

Closed on October 25, 2019, 6:23am UTC

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