# Nested objects are not displayed correctly in Discover dashboard

**URL:** <https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748>\
**Category:** Reporting Plugin\
**Tags:** troubleshoot\
**Created:** [December 9, 2022, 7:36am UTC](https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748 "2022-12-09T07:36:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chelsey](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chelsey](https://forum.opensearch.org/u/chelsey)\
**Post date:** [December 9, 2022, 7:36am UTC](https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748/1 "2022-12-09T07:36:30Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch v1.3.6, OpenSearch Dashboard v1.3.6, MacOS, Chrome

**Describe the issue** :

1. Go to Dev Tools. Create an index `testindex2` with mappings

```auto
PUT testindex2
{
  "mappings": {
    "properties": {
      "patients": {
        "properties": {
          "name": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "age": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "smoker": {
            "type": "boolean"
          }
        }
      }
    }
  }
}

```

1. Insert a document.

```auto
PUT testindex2/_doc/100
{ 
  "patients": [ 
    {"name" : "John Doe", "age" : "56", "smoker" : true},
    {"name" : "Mary Major", "age" : "85", "smoker" : false}
  ] 
}

```

1. Click on ‘Stack Management’ and create an index pattern for `testindex2`
2. Go to the ‘Discover’ page
3. Click on ‘Filter by Type’ and disable ‘Hide missing fields’
4. Add `patients.age` and `patients.name` from the ‘Available fields’

Referred to the [documentation](https://opensearch.org/docs/2.4/opensearch/supported-field-types/nested/#flattened-form) on nested objects.

**Expected behavior**  
There should be 1 hit with 2 columns - `patients.name` has `["John Doe", "Mary Major"] value,` and `patients.age` has `[56, 85]` value. However, they are all empty.

**Configuration** :

**Relevant Logs or Screenshots** :

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/4/444a60dda1b73f2c079a419a0e5d94284d868e2b.png)

---

<div class="post-metadata">

**Author:** ![AMoo-Miki](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/amoo-miki/32/4642_2.png) [@AMoo-Miki](https://forum.opensearch.org/u/AMoo-Miki)\
**Post date:** [December 20, 2022, 9:27pm UTC](https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748/2 "2022-12-20T21:27:06Z")

</div>

@chelsey, the Discover page is not capable of showing nested objects in the tabular format. The documentation you linked to which mentions “When these objects are stored, they are flattened” is talking about the inner workings of OpenSearch and not what you get from OpenSearch when you query the data. The Discover page simply queries OpenSearch to get the objects that match your query and the JSON output is exactly what it gets back from OpenSearch.

---

<div class="post-metadata">

**Author:** ![chelsey](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chelsey](https://forum.opensearch.org/u/chelsey)\
**Post date:** [January 3, 2023, 2:28am UTC](https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748/3 "2023-01-03T02:28:19Z")

</div>

Hi @AMoo-Miki , thanks for your response.

Yes, the JSON output is correct for `patients`. But I would expect that the nested field `patients.age` returns an aggregated value which is an array `[56, 85]`, not an empty value.

When I search the index, using `GET testindex2/_search` with the field `patients.age` from the Dev console, it returns the correct array. The same result should be expected in the Discover page.

This was able to work in Kibana. Is it a missing feature in OpenSearch Dashboard?

---

<div class="post-metadata">

**Author:** ![AMoo-Miki](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/amoo-miki/32/4642_2.png) [@AMoo-Miki](https://forum.opensearch.org/u/AMoo-Miki)\
**Post date:** [January 17, 2023, 7:12pm UTC](https://forum.opensearch.org/t/nested-objects-are-not-displayed-correctly-in-discover-dashboard/11748/4 "2023-01-17T19:12:08Z")

</div>

> Yes, the JSON output is correct for `patients`.

Great so we have the correct data recorded

> But I would expect that the nested field `patients.age` returns an aggregated value which is an array `[56, 85]`, not an empty value.

Since Discover is unable to handle nested fields, it doesn’t see those fields and shows them as empty. The effort for revamping Discover is tracked under “[Data Explorer - Revamping Discover to be able to be used for all of OpenSearch Dashboards data exploration use cases · Issue #3056 · opensearch-project/OpenSearch-Dashboards · GitHub](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3056)”.

> When I search the index, using `GET testindex2/_search` with the field `patients.age` from the Dev console, it returns the correct array. The same result should be expected in the Discover page.

When I run the query against OpenSearch with

```auto
GET testindex2/_search
{
  "_source": "patients.age"
}

```

… I get an array of objects and not an array of numbers:

```auto
...
        "_source" : {
          "patients" : [
            {
              "age" : "56"
            },
            {
              "age" : "85"
            }
          ]
        }
...

```

This nested object structure contributes to Discover’s inability to render them in the table.

> This was able to work in Kibana. Is it a missing feature in OpenSearch Dashboard?

The Kibana versions that I have used couldn’t handle nested objects in the tabular format either; maybe the newer versions do.
