# How to read Data from ES response

**URL:** https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213
**Category:** Elasticsearch
**Created:** [April 18, 2023, 10:56am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213 "2023-04-18T10:56:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)
#### Post date: [April 18, 2023, 10:56am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/1 "2023-04-18T10:56:56Z")

</div>

Hi, so I see the response of ES is tied to the kind of Query I write. I know Kibana is able to map it into charts so there must be a formal way of extracting information of _BUCKETS_ property. Can I get info about it or is it a open-source lib?

Example Request

```auto
{
    "size": 0,
    "aggs": {
        "agg_project": {
            "terms": {
                "field": "project.code"
            },
            "aggs": {
                "agg_custom_field": {
                    "nested": {
                        "path": "traceability"
                    },
                    "aggs": {
                        "agg_value": {
                            "terms": {
                                "field": "traceability.status"
                            }
                        }
                    }
                }
            }
        }
    }
}

```

Response

```auto
{
  "agg_project": {
    "doc_count_error_upper_bound": 0,
    "sum_other_doc_count": 3607,
    "buckets": [
      {
        "key": "NXTMigrationTest",
        "doc_count": 1546,
        "agg_custom_field": {
          "doc_count": 2674,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 156,
            "buckets": [
              {
                "key": "New",
                "doc_count": 635
              },
              {
                "key": "Ready for Release",
                "doc_count": 521
              },
              {
                "key": "Done",
                "doc_count": 400
              },
              {
                "key": "SIT",
                "doc_count": 275
              },
              {
                "key": "Closed",
                "doc_count": 224
              },
              {
                "key": "Internal Review Done",
                "doc_count": 136
              },
              {
                "key": "Ready for UAT",
                "doc_count": 91
              },
              {
                "key": "Build in progress",
                "doc_count": 85
              },
              {
                "key": "To Do",
                "doc_count": 85
              },
              {
                "key": "Rejected",
                "doc_count": 66
              }
            ]
          }
        }
      },
      {
        "key": "copyofInvocare120223_1",
        "doc_count": 1232,
        "agg_custom_field": {
          "doc_count": 280,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 216
              },
              {
                "key": "Rejected",
                "doc_count": 22
              },
              {
                "key": "Closed",
                "doc_count": 13
              },
              {
                "key": "Ready for Release",
                "doc_count": 13
              },
              {
                "key": "To Do",
                "doc_count": 6
              },
              {
                "key": "Open",
                "doc_count": 5
              },
              {
                "key": "READY TO TEST",
                "doc_count": 2
              },
              {
                "key": "FIX IN PROGRESS",
                "doc_count": 1
              },
              {
                "key": "New",
                "doc_count": 1
              },
              {
                "key": "Prioritised",
                "doc_count": 1
              }
            ]
          }
        }
      },
      {
        "key": "AutomationDemo",
        "doc_count": 1219,
        "agg_custom_field": {
          "doc_count": 280,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 216
              },
              {
                "key": "Rejected",
                "doc_count": 22
              },
              {
                "key": "Closed",
                "doc_count": 13
              },
              {
                "key": "Ready for Release",
                "doc_count": 13
              },
              {
                "key": "To Do",
                "doc_count": 6
              },
              {
                "key": "Open",
                "doc_count": 5
              },
              {
                "key": "READY TO TEST",
                "doc_count": 2
              },
              {
                "key": "FIX IN PROGRESS",
                "doc_count": 1
              },
              {
                "key": "New",
                "doc_count": 1
              },
              {
                "key": "Prioritised",
                "doc_count": 1
              }
            ]
          }
        }
      },
      {
        "key": "copyofInvocare030123",
        "doc_count": 1214,
        "agg_custom_field": {
          "doc_count": 280,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 216
              },
              {
                "key": "Rejected",
                "doc_count": 22
              },
              {
                "key": "Closed",
                "doc_count": 13
              },
              {
                "key": "Ready for Release",
                "doc_count": 13
              },
              {
                "key": "To Do",
                "doc_count": 6
              },
              {
                "key": "Open",
                "doc_count": 5
              },
              {
                "key": "READY TO TEST",
                "doc_count": 2
              },
              {
                "key": "FIX IN PROGRESS",
                "doc_count": 1
              },
              {
                "key": "New",
                "doc_count": 1
              },
              {
                "key": "Prioritised",
                "doc_count": 1
              }
            ]
          }
        }
      },
      {
        "key": "copyofInvocare02122022",
        "doc_count": 1205,
        "agg_custom_field": {
          "doc_count": 265,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 206
              },
              {
                "key": "Rejected",
                "doc_count": 22
              },
              {
                "key": "Closed",
                "doc_count": 13
              },
              {
                "key": "Ready for Release",
                "doc_count": 13
              },
              {
                "key": "Open",
                "doc_count": 5
              },
              {
                "key": "READY TO TEST",
                "doc_count": 2
              },
              {
                "key": "To Do",
                "doc_count": 2
              },
              {
                "key": "FIX IN PROGRESS",
                "doc_count": 1
              },
              {
                "key": "Prioritised",
                "doc_count": 1
              }
            ]
          }
        }
      },
      {
        "key": "copyofInvocare21112022",
        "doc_count": 1169,
        "agg_custom_field": {
          "doc_count": 262,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 203
              },
              {
                "key": "Rejected",
                "doc_count": 22
              },
              {
                "key": "Closed",
                "doc_count": 13
              },
              {
                "key": "Ready for Release",
                "doc_count": 13
              },
              {
                "key": "Open",
                "doc_count": 5
              },
              {
                "key": "READY TO TEST",
                "doc_count": 2
              },
              {
                "key": "To Do",
                "doc_count": 2
              },
              {
                "key": "FIX IN PROGRESS",
                "doc_count": 1
              },
              {
                "key": "Prioritised",
                "doc_count": 1
              }
            ]
          }
        }
      },
      {
        "key": "copyofInvocare311022",
        "doc_count": 1147,
        "agg_custom_field": {
          "doc_count": 0,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": []
          }
        }
      },
      {
        "key": "copyofInvocare251022",
        "doc_count": 1137,
        "agg_custom_field": {
          "doc_count": 0,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": []
          }
        }
      },
      {
        "key": "copyofInvocare26092022",
        "doc_count": 1119,
        "agg_custom_field": {
          "doc_count": 0,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": []
          }
        }
      },
      {
        "key": "eCommerce",
        "doc_count": 839,
        "agg_custom_field": {
          "doc_count": 1586,
          "agg_value": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
              {
                "key": "Done",
                "doc_count": 1201
              },
              {
                "key": "To Do",
                "doc_count": 134
              },
              {
                "key": "In Progress",
                "doc_count": 129
              },
              {
                "key": "In QA",
                "doc_count": 68
              },
              {
                "key": "PO Approval",
                "doc_count": 23
              },
              {
                "key": "Code review",
                "doc_count": 17
              },
              {
                "key": "Ready for QA",
                "doc_count": 8
              },
              {
                "key": "On Hold",
                "doc_count": 6
              }
            ]
          }
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 18, 2023, 11:02am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/2 "2023-04-18T11:02:13Z")

</div>

You can use something like `jq` to extract this from the json, but that may not help your situation. Can you provide more info on what you are looking to do so we can provide contextually specific help?

---

<div class="post-metadata">

### Author: ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)
#### Post date: [April 18, 2023, 11:07am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/3 "2023-04-18T11:07:16Z")

</div>

So we want to render charts on the result of ES queries, but we need to convert ES response to Charts input type. And since queries could of any type, the response comes in same structure.

We just want to code the middleware to support all such transformations

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 18, 2023, 11:07am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/4 "2023-04-18T11:07:47Z")

</div>

Are you basically saying you want to build your own Kibana?

---

<div class="post-metadata">

### Author: ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)
#### Post date: [April 18, 2023, 11:10am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/5 "2023-04-18T11:10:19Z")

</div>

Not like kibana. Just the charts rendering static. We already have our dashboards, its an addition to our exisiting codebase.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 18, 2023, 11:24am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/6 "2023-04-18T11:24:21Z")

</div>

Maybe look at [GitHub - elastic/eui: Elastic UI Framework 🙌](https://github.com/elastic/eui)?

---

<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: [May 16, 2023, 11:24am UTC](https://discuss.elastic.co/t/how-to-read-data-from-es-response/330213/7 "2023-05-16T11:24:28Z")

</div>

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