90 lines
2.4 KiB
Text
90 lines
2.4 KiB
Text
[[saved-objects-api-find]]
|
|
=== Find objects API
|
|
++++
|
|
<titleabbrev>Find objects</titleabbrev>
|
|
++++
|
|
|
|
experimental[] Retrieve a paginated set of {kib} saved objects by various conditions.
|
|
|
|
[[saved-objects-api-find-request]]
|
|
==== Request
|
|
|
|
`GET /api/saved_objects/_find`
|
|
|
|
[[saved-objects-api-find-query-params]]
|
|
==== Query Parameters
|
|
|
|
`type`::
|
|
(Required, array|string) The saved object types to include in the export.
|
|
|
|
`per_page`::
|
|
(Optional, number) The number of objects to return per page.
|
|
|
|
`page`::
|
|
(Optional, number) The page of objects to return.
|
|
|
|
`search`::
|
|
(Optional, string) An Elasticsearch {ref}/query-dsl-simple-query-string-query.html[simple_query_string] query that filters the objects in the response.
|
|
|
|
`default_search_operator`::
|
|
(Optional, string) The default operator to use for the `simple_query_string`.
|
|
|
|
`search_fields`::
|
|
(Optional, array|string) The fields to perform the `simple_query_string` parsed query against.
|
|
|
|
`fields`::
|
|
(Optional, array|string) The fields to return in the response.
|
|
|
|
`sort_field`::
|
|
(Optional, string) The field that sorts the response.
|
|
|
|
`has_reference`::
|
|
(Optional, object) Filters to objects that have a relationship with the type and ID combination.
|
|
|
|
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
|
|
|
|
`200`::
|
|
Indicates a successful call.
|
|
|
|
==== Examples
|
|
|
|
Find index patterns with titles that start with `my`:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET api/saved_objects/_find?type=index-pattern&search_fields=title&search=my*
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|
|
The API returns the following:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"total": 1,
|
|
"data": [
|
|
{
|
|
"id": "my-pattern",
|
|
"type": "index-pattern",
|
|
"version": 1,
|
|
"attributes": {
|
|
"title": "my-pattern-*"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
--------------------------------------------------
|
|
|
|
For parameters that accept multiple values (e.g. `fields`), repeat the
|
|
query parameter for each value:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET api/saved_objects/_find?fields=id&fields=title
|
|
--------------------------------------------------
|
|
// KIBANA
|
|
|