# Array support in http/json metricset doesn't handle simple String Arrays

**URL:** <https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [December 18, 2018, 2:17pm UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342 "2018-12-18T14:17:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [December 18, 2018, 2:17pm UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/1 "2018-12-18T14:17:10Z")

</div>

We are currently trying to pull data from an application that exposes a list of connected systems as a REST endpoint, returning a simple String array. So when I call [http://example.com/rest/connectedSystems/](http://example.com/rest/connectedSystems/) it returns

`["systemA", "systemB", "anotherOne", "theLastOne"]`

This doesn't work with the standard http/json metricset, even with `json.is_array: true`

The problem seems to be that pull request #6480 added support for JSON arrays containing JSON objects (type `[]common.MapStr`) but not for simple String arrays (which are still valid JSON I believe).

Is there a way to get this scenario supported easily?

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 19, 2018, 4:39pm UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/2 "2018-12-19T16:39:29Z")

</div>

Hi @BennyInc,

As you are seeing, at the moment this metricset only supports parsing objects, or lists of objects, but not lists of simple values. We could consider to open an enhacement request to support this, but I wonder how would you expect to store and consume a list of systems like this one.

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [December 20, 2018, 8:51am UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/3 "2018-12-20T08:51:29Z")

</div>

Basically I'd like to be able to track which systems are connected at any given point in time. This can be done by storing one doc for each system and timestamp, allowing me to aggregate later on.  
So I could later query for systemA, and see at what times it was or was not connected. Also, I'd be able to use a cardinality query to see how many systems were connected at any given time (having a trend graph on Kibana for it).

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [December 20, 2018, 4:34pm UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/4 "2018-12-20T16:34:44Z")

</div>

Ok, I guess that an option could be to parse the array when `json.is_array` is set to true, and store the single values, one per doc, in the `namespace`. Could you please [open an enhancement request](https://github.com/elastic/beats/issues/new?template=feature-request.md) for this?

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [December 21, 2018, 9:16am UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/5 "2018-12-21T09:16:05Z")

</div>

Done, thanks. [#9743](https://github.com/elastic/beats/issues/9743) is opened.

---

<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:** [January 18, 2019, 9:19am UTC](https://discuss.elastic.co/t/array-support-in-http-json-metricset-doesnt-handle-simple-string-arrays/161342/6 "2019-01-18T09:19:11Z")

</div>

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