# Get data from visualize/ dashboard using the API

**URL:** <https://discuss.elastic.co/t/get-data-from-visualize-dashboard-using-the-api/83684>\
**Category:** Kibana\
**Created:** [April 26, 2017, 11:23am UTC](https://discuss.elastic.co/t/get-data-from-visualize-dashboard-using-the-api/83684 "2017-04-26T11:23:39Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [April 27, 2017, 1:23pm UTC](https://discuss.elastic.co/t/get-data-from-visualize-dashboard-using-the-api/83684/6 "2017-04-27T13:23:23Z")

</div>

`your mileage may vary` = `your experience may be different`.

> **[Urban Dictionary: ymmv](https://www.urbandictionary.com/define.php?term=ymmv)**
>
> Literally means "Your mileage may vary" but is often used in forum talk meaning that your results will vary

So basically I'm saying I didn't get those third-party plugins for CSV output to work, but I could have done something wrong and they may work just fine for someone else.

If I have this random visualization;

 ![](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d49a4a442d29c3dca895077542be0a3ce9639f6.png)

I click the arrow under the chart and then I see this;

 ![](https://us1.discourse-cdn.com/elastic/original/3X/8/5/853aeab199a0f2d81429c9e02a956f4c4d8d73ca.png)

Click the Request button (and optionally the expand icon circled in red);

 ![](https://us1.discourse-cdn.com/elastic/original/3X/9/8/983cd2c2fdf9c453d49dc51fc3af46a54556360f.jpg)

If I copy that query and go to the Kibana \> Dev Tools \> Console, I can paste it along with `GET <my index pattern>/_search` like this;

```auto
GET test4/_search
{
  "query": {
    "query_string": {
      "analyze_wildcard": true,
      "query": "*"
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "histogram": {
        "field": "number",
        "interval": 1,
        "min_doc_count": 1
      },
      "aggs": {
        "1": {
          "max": {
            "field": "count"
          }
        }
      }
    }
  }
}

```

and I get the results like in the data table of the visualization;

```auto
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 4,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "2": {
      "buckets": [
        {
          "1": {
            "value": 20
          },
          "key": 1,
          "doc_count": 1
        },
        {
          "1": {
            "value": 30
          },
          "key": 2,
          "doc_count": 1
        },
        {
          "1": {
            "value": 50
          },
          "key": 3,
          "doc_count": 1
        },
        {
          "1": {
            "value": 40
          },
          "key": 4,
          "doc_count": 1
        }
      ]
    }
  }
}

```

I can click the wrench in the Console to copy that query as curl;

 ![](https://us1.discourse-cdn.com/elastic/original/3X/d/0/d038a8bdff811e147045122b3614d36d2d5a01c3.png)

In my case, I need to add authentication and `-k` to ignore my invalid ssl certificate. The results are at the bottom.  
You'll probably have to scroll over to see them;

```auto
$ curl -k -XGET "https://elastic:changeit@localhost:9200/test4/_search" -H 'Content-Type: application/json' -d'
{
  "query": {
    "query_string": {
      "analyze_wildcard": true,
      "query": "*"
    }
  },
  "size": 0,
  "_source": {
    "excludes": []
  },
  "aggs": {
    "2": {
      "histogram": {
        "field": "number",
        "interval": 1,
        "min_doc_count": 1
      },
      "aggs": {
        "1": {
          "max": {
            "field": "count"
          }
        }
      }
    }
  }
}'
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 738 100 336 100 402 1953 2337 --:--:-- --:--:-- --:--:-- 2337{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":4,"max_score":0.0,"hits":[]},"aggregations":{"2":{"buckets":[{"key":1.0,"doc_count":1,"1":{"value":20.0}},{"key":2.0,"doc_count":1,"1":{"value":30.0}},{"key":3.0,"doc_count":1,"1":{"value":50.0}},{"key":4.0,"doc_count":1,"1":{"value":40.0}}]}}}

```

You could use any language or library that does http GET requests.

Hope this helps.

Regards,  
Lee

---

_[View the full topic](https://discuss.elastic.co/t/get-data-from-visualize-dashboard-using-the-api/83684)._
