2018-05-30 18:27:48 +02:00
[[saved-objects-api-find]]
2019-09-06 18:09:57 +02:00
=== Find objects API
++++
<titleabbrev>Find objects</titleabbrev>
++++
2018-05-30 18:27:48 +02:00
2019-09-18 17:54:28 +02:00
experimental[] Retrieve a paginated set of {kib} saved objects by various conditions.
2018-12-05 22:20:58 +01:00
2019-09-06 18:09:57 +02:00
[[saved-objects-api-find-request]]
2018-05-30 18:27:48 +02:00
==== Request
`GET /api/saved_objects/_find`
2019-10-18 19:17:54 +02:00
`GET /s/<space_id>/api/saved_objects/_find`
[[saved-objects-api-find-path-params]]
==== Path parameters
`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in the URL, the default space is used.
2019-09-06 18:09:57 +02:00
[[saved-objects-api-find-query-params]]
2018-05-30 18:27:48 +02:00
==== Query Parameters
2019-09-06 18:09:57 +02:00
`type`::
(Required, array|string) The saved object types to include in the export.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`per_page`::
(Optional, number) The number of objects to return per page.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`page`::
(Optional, number) The page of objects to return.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`search`::
(Optional, string) An Elasticsearch {ref}/query-dsl-simple-query-string-query.html[simple_query_string] query that filters the objects in the response.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`default_search_operator`::
(Optional, string) The default operator to use for the `simple_query_string`.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`search_fields`::
(Optional, array|string) The fields to perform the `simple_query_string` parsed query against.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`fields`::
(Optional, array|string) The fields to return in the response.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`sort_field`::
(Optional, string) The field that sorts the response.
2019-10-18 19:17:54 +02:00
2019-09-06 18:09:57 +02:00
`has_reference`::
(Optional, object) Filters to objects that have a relationship with the type and ID combination.
2019-10-03 00:23:44 +02:00
`filter`::
(Optional, string) The filter is a KQL string with the caveat that if you filter with an attribute from your type saved object.
It should look like that savedObjectType.attributes.title: "myTitle". However, If you used a direct attribute of a saved object like `updatedAt`,
you will have to define your filter like that savedObjectType.updatedAt > 2018-12-22.
2019-09-06 18:09:57 +02:00
NOTE: As objects change in {kib}, the results on each page of the response also
change. Use the find API for traditional paginated results, but avoid using it to export large amounts of data.
[[saved-objects-api-find-request-codes]]
==== Response code
2019-10-18 19:17:54 +02:00
`200`::
2019-09-06 18:09:57 +02:00
Indicates a successful call.
2018-05-30 18:27:48 +02:00
==== Examples
2019-09-06 18:09:57 +02:00
Find index patterns with titles that start with `my`:
2018-05-30 18:27:48 +02:00
[source,js]
--------------------------------------------------
GET api/saved_objects/_find?type=index-pattern&search_fields=title&search=my*
--------------------------------------------------
// KIBANA
2019-09-06 18:09:57 +02:00
The API returns the following:
2018-05-30 18:27:48 +02:00
[source,js]
--------------------------------------------------
{
"total": 1,
"data": [
{
"id": "my-pattern",
"type": "index-pattern",
"version": 1,
"attributes": {
"title": "my-pattern-*"
}
}
]
}
--------------------------------------------------
2019-09-06 18:09:57 +02:00
For parameters that accept multiple values (e.g. `fields`), repeat the
2018-05-30 18:27:48 +02:00
query parameter for each value:
[source,js]
--------------------------------------------------
GET api/saved_objects/_find?fields=id&fields=title
--------------------------------------------------
// KIBANA