# Kibana - How to do customized sort to saved objects API

**URL:** <https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681>\
**Category:** Kibana\
**Created:** [March 9, 2021, 11:25am UTC](https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681 "2021-03-09T11:25:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saifabusaleh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saifabusaleh/32/85224_2.png) [@saifabusaleh](https://discuss.elastic.co/u/saifabusaleh)\
**Post date:** [March 9, 2021, 11:25am UTC](https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681/1 "2021-03-09T11:25:56Z")

</div>

Hi,

We use:  
`Kibana 7.10.0`  
`Elastic 7.10.2`

We use Kibana Saved Objects Find API to get all dashboards (`https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html`)

We want to get this dashboard data sorted by custom field

We found that there is `sort_field` field that can be sent to the API

We want to add custom field, and set it values depending on our needs

For example:

To add `order` field to the attributes and then we can send `sort_field=order`

Is this possible? How we can do that?

Thanks

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [March 17, 2021, 4:22am UTC](https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681/2 "2021-03-17T04:22:18Z")

</div>

According to the documentation, you should be able to send requests such as:

`GET /api/saved_objects/_find?type=search&sort_field=updated_at`

And you should also be able to sort based on title:

> "type" fields are specific to an object type, such as fields returned in the `attributes` key of the response

That would look like:  
`GET /api/saved_objects/_find?type=index-pattern&sort_field=attributes.title`

However, I was not able to get the latter example working in my local environment. If you are facing the same issue, I would recommend that you file a bug and describe your use case and results: [Sign in to GitHub · GitHub](https://github.com/elastic/kibana/issues/new)

EDIT: I filed this issue: [Find objects API: Unable to sort saved objects by "type" fields · Issue #94777 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/94777)

---

<div class="post-metadata">

**Author:** ![Pierre\_Gayvallet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierre_gayvallet/32/77239_2.png) [@Pierre\_Gayvallet](https://discuss.elastic.co/u/Pierre_Gayvallet)\
**Post date:** [April 1, 2021, 7:27am UTC](https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681/3 "2021-04-01T07:27:52Z")

</div>

> [@tsullivan](#):
>
> GET /api/saved\_objects/\_find?type=search&sort\_field=updated\_at

The `sortField` parameter is a bit magical by the fact that you can either pass a 'root' field or an 'attributes' field without prefixes

However,

1. Only the following root fields are supported:

- '\_id'
- '\_score'

1. ES limitations still apply to the sort fields. e.g you can't use a `text` field as a sort field

`GET /api/saved_objects/_find?type=index-pattern&sort_field=title` for example is invalid, as the `title` field of the index patterns is a `text` field

---

<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:** [April 29, 2021, 7:28am UTC](https://discuss.elastic.co/t/kibana-how-to-do-customized-sort-to-saved-objects-api/266681/4 "2021-04-29T07:28:07Z")

</div>

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