# Setup json metricset in module http

**URL:** <https://discuss.elastic.co/t/setup-json-metricset-in-module-http/217652>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 3, 2020, 3:40pm UTC](https://discuss.elastic.co/t/setup-json-metricset-in-module-http/217652 "2020-02-03T15:40:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![coute](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/coute/32/56713_2.png) [@coute](https://discuss.elastic.co/u/coute)\
**Post date:** [February 3, 2020, 3:40pm UTC](https://discuss.elastic.co/t/setup-json-metricset-in-module-http/217652/1 "2020-02-03T15:40:09Z")

</div>

Hello,  
I use module http in metricbeat to get some values through an API.  
The API return a json looking like that :

```
{
      "items" : [ {
        "timeSeries" : [ {
          "metadata" : {
            "metricName" : "allocated_vcores_cumulative",
            "startTime" : "2020-02-03T14:12:56.168Z",
            "endTime" : "2020-02-03T14:17:56.168Z",
            "attributes" : {
              "clusterName" : "cluster2",
            }
          },
          "data" : [ {
            "timestamp" : "2020-02-03T14:13:43.757Z",
            "value" : 549.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:14:43.757Z",
            "value" : 549.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:15:43.759Z",
            "value" : 374.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:16:43.760Z",
            "value" : 373.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:17:43.780Z",
            "value" : 373.0,
            "type" : "SAMPLE"
          } ]
        }, {
          "metadata" : {
            "metricName" : "available_vcores",
            "startTime" : "2020-02-03T14:12:56.168Z",
            "endTime" : "2020-02-03T14:17:56.168Z",
            "attributes" : {
              "clusterName" : "cluster2",
            }
          },
          "data" : [ {
            "timestamp" : "2020-02-03T14:13:43.757Z",
            "value" : 159.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:14:43.757Z",
            "value" : 159.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:15:43.759Z",
            "value" : 334.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:16:43.760Z",
            "value" : 335.0,
            "type" : "SAMPLE"
          }, {
            "timestamp" : "2020-02-03T14:17:43.780Z",
            "value" : 335.0,
            "type" : "SAMPLE"
          } ]
        } ],
        "warnings" : []
      } ]
}

```

Here is my setup in metricbeat :

```
  - module: http
    enabled: true
    period: 5m
    hosts: ["http://cluster.api.priv:1234"]
    namespace: "api"
    path: "/api/timeseries"
    query:
      contentType: "application/json"
    json.is_array: false
    metricsets:
      - json

```

In Elasticsearch, i have a new field in the index "api.items" that contain the request result.  
I can't set up a specific field that i want to store.  
My wish is to store one document for each element in the array timeSeries with "metadata" and "data" fields.

---

<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 2, 2020, 3:40pm UTC](https://discuss.elastic.co/t/setup-json-metricset-in-module-http/217652/2 "2020-03-02T15:40:10Z")

</div>

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