Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openAPI doc for saved_object find api #6856

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/6856.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
doc:
- Add openAPI doc for saved_object find api ([#6856](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6856))
115 changes: 114 additions & 1 deletion docs/openapi/saved_objects/saved_objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,125 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/400_bad_request'
/api/saved_objects/_find:
get:
tags:
- saved objects
summary: Find saved objects through query.
parameters:
- in: query
name: type
description: The type of saved objects to find.
required: true
schema:
oneOf:
- type: string
- type: array
example: dashboard
- in: query
name: per_page
description: The number of saved objects to return per page.
schema:
type: integer
minimum: 0
default: 20
example: 50
- in: query
name: page
description: The page of objects to return.
schema:
type: integer
minimum: 0
default: 1
example: 1
- in: query
name: search
description: The search query that filters the saved objects.
schema:
type: string
example: "open*"
Comment on lines +173 to +176
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a specified syntax for the search query? e.g. is it just glob

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses simple_query_string query that filters the objects in the response. The syntax is quite simple

+ signifies AND operation
| signifies OR operation
- negates a single token
" wraps a number of tokens to signify a phrase for searching
* at the end of a term signifies a prefix query
( and ) signify precedence
~N after a word signifies edit distance (fuzziness)
~N after a phrase signifies slop amount

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update the description here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update the description in the next PR

- in: query
name: default_search_operator
description: The default operator for the search query.
schema:
type: string
enum:
- AND
- OR
default: OR
example: OR
- in: query
name: search_fields
description: The fields to search on by the query.
schema:
oneOf:
- type: string
- type: array
example: title
- in: query
name: sort_field
description: Sorts the response by selected field.
schema:
type: string
example: _score
- in: query
name: has_reference
description: Filters the saved objects that have a reference with the type and ID combination.
schema:
type: object
properties:
type:
type: string
id:
type: string
example: { "type": "visualization", "id": "37cc8650-b882-11e8-a6d9-e546fe2bba5f" }
- in: query
name: fields
description: The fields to return in the response.
schema:
oneOf:
- type: string
- type: array
example: title
- in: query
name: filter
description: A filter string that you can filter the saved object with attributes.
schema:
type: string
example: 'visualization.attributes.title:*'
- in: query
name: namespace
description: Namespaces that this saved object exists in. This attribute is only used for multi-namespace saved object types.
schema:
oneOf:
- type: string
- type: array
- in: query
name: workspace
description: Workspaces that this saved object exists in.
schema:
oneOf:
- type: string
- type: array
responses:
'200':
description: The saved objects are successfully found.
content:
application/json:
schema:
type: object
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_bad_request'
components:
parameters:
type:
name: type
in: path
description: The type of SavedObject to retrieve
description: The type of SavedObject to retrieve.
required: true
schema:
type: string
Expand Down
Loading