# Kibana API: How to specify fields to be fetched in a GET call from saved\_objects?

**URL:** <https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790>\
**Category:** Kibana\
**Created:** [July 11, 2020, 8:45am UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790 "2020-07-11T08:45:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [July 11, 2020, 8:45am UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/1 "2020-07-11T08:45:22Z")

</div>

I'm trying to get list of Dashboards via API

```auto
http://localhost:5601/api/saved_objects/_find?type=dashboard&fields=id&fields=title

```

But this gives quite other fields (like references & type of visualizations etc), though I've specified fields required is just id & title.

eg BELOW is the current output, but I expected only "id" and "title" of from "dashboard" type

```auto
{
    "page": 1,
    "per_page": 20,
    "total": 2,
    "saved_objects": [
        {
            "type": "dashboard",
            "id": "7adfa750-4c81-11e8-b3d7-01146121b73d",
            "attributes": {
                "title": "[Flights] Global Flight Dashboard"
            },
            "references": [
                {
                    "name": "panel_0",
                    "id": "aeb212e0-4c84-11e8-b3d7-01146121b73d",
                    "type": "visualization"
                },
       ......

```

How to ensure that we receive **ONLY** the **fields** we specify in the GET call?

---

<div class="post-metadata">

**Author:** ![joshdover](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshdover/32/42020_2.png) [@joshdover](https://discuss.elastic.co/u/joshdover)\
**Post date:** [July 13, 2020, 5:08pm UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/2 "2020-07-13T17:08:53Z")

</div>

Hi there!

I believe the `fields` parameter only applies to the fields stored inside `attributes`. All other fields will always be returned. This should be clarified in our documentation.

EDIT: I've opened a pull request to update these docs: [https://github.com/elastic/kibana/pull/71491](https://github.com/elastic/kibana/pull/71491)

---

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [July 13, 2020, 6:31pm UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/3 "2020-07-13T18:31:58Z")

</div>

@joshdover  
thanks for the explanation.  
Any idea how to return Only the Required fields back? So I can display it into a table etc.

---

<div class="post-metadata">

**Author:** ![joshdover](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshdover/32/42020_2.png) [@joshdover](https://discuss.elastic.co/u/joshdover)\
**Post date:** [July 13, 2020, 7:36pm UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/4 "2020-07-13T19:36:42Z")

</div>

Our API will always return these base fields (id, attributes, references, etc.) and there is no way to limit that from the API side.

You'll need to do this in your application / script code. For instance, if you're in JavaScript you could do:

```javascript
response.saved_objects.map(o => return { id: o.id, title: o.attributes.title });

```

If you're doing this on the command line, I recommend checking out the [jq](https://stedolan.github.io/jq/) utility. Other than that, it just really depends on this is being consumed, but we have no feature for this in the API itself.

Hope that was helpful!

---

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [July 13, 2020, 7:47pm UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/5 "2020-07-13T19:47:06Z")

</div>

thanks. Upvoted and made as solution.  
Wished we had the ability to do the above javascript within Kibana 😇

---

<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:** [August 10, 2020, 7:47pm UTC](https://discuss.elastic.co/t/kibana-api-how-to-specify-fields-to-be-fetched-in-a-get-call-from-saved-objects/240790/6 "2020-08-10T19:47:22Z")

</div>

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