# How to query Elasticsearch datasource in Grafana?

**URL:** <https://discuss.elastic.co/t/how-to-query-elasticsearch-datasource-in-grafana/340682>\
**Category:** Elasticsearch\
**Created:** [August 12, 2023, 10:49am UTC](https://discuss.elastic.co/t/how-to-query-elasticsearch-datasource-in-grafana/340682 "2023-08-12T10:49:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZahraZare](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zahrazare/32/112102_2.png) [@ZahraZare](https://discuss.elastic.co/u/ZahraZare)\
**Post date:** [August 12, 2023, 10:49am UTC](https://discuss.elastic.co/t/how-to-query-elasticsearch-datasource-in-grafana/340682/1 "2023-08-12T10:49:39Z")

</div>

I want to use an index in Elasticsearch as a data source in Grafana. But I can't query it and extract a specific field from it. I want to have only the data of the fields I want as output from among several fields in this data source, like an RDBMs where columns can be selected. in elasticsearch, By default, a GET request will return the whole document, as stored in the \_source field. Individual fields can be requested by using the \_source parameter. Multiple fields can be specified in a comma-separated list:

```auto
GET /website/blog/123?_source=title,text

```

But when I use this query in Grafana, nothing is displayed in the output.

```auto
 timestamp: * AND _source=DTLS_MA

```

This query says to display only the DTLS\_MA field values in the output for all days (Because each index document is used for a specific day. So I set the value of my timestamp column equal to \* to fetch all the documents) The field DTLS\_MA is a dictionary like below:

```auto
"DTLS_MA" : {
            "IS_AVAILABLE" : true,
            "VOICE_DIFF" : 0,
            "VOICE_CNT" : 157720612,
            "VSMS_DIFF" : null,
            "VSMS_CNT" : null,
            "SMS_DIFF" : 0,
            "SMS_CNT" : 208672130,
            "HSDP_DIFF" : null,
            "HSDP_CNT" : null,
            "GPRS_DIFF" : 0,
            "GPRS_CNT" : 942823463,
            "RBT_DIFF" : null,
            "RBT_CNT" : null,
            "CMN_DIFF" : null,
            "CMN_CNT" : null,
            "MVPN_DIFF" : null,
            "MVPN_CNT" : null,
            "MVPN_RTC_DIFF" : null,
            "MVPN_RTC_CNT" : null,
            "COMPOSITE_DIFF" : null,
            "COMPOSITE_CNT" : null,
            "MMS_DIFF" : null,
            "MMS_CNT" : null
          }

```

---

<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:** [September 9, 2023, 10:49am UTC](https://discuss.elastic.co/t/how-to-query-elasticsearch-datasource-in-grafana/340682/2 "2023-09-09T10:49:50Z")

</div>

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