# Backport
This will backport the following commits from `main` to `8.8`:
- [[DOCS] Adds shards object to Create pack and Update pack API
(#166363)](https://github.com/elastic/kibana/pull/166363)
<!--- Backport version: 8.9.7 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT
[{"author":{"name":"natasha-moore-elastic","email":"137783811+natasha-moore-elastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-09-18T13:55:57Z","message":"[DOCS]
Adds shards object to Create pack and Update pack API (#166363)\n\n##
Summary\r\n\r\n- Resolves
https://github.com/elastic/security-docs/issues/3822 \r\n\r\nAdds the
`shards` object schema definition to Create pack and Update\r\npack API,
and to the Create pack request example.\r\n\r\n- Related dev PR:
https://github.com/elastic/kibana/pull/166178","sha":"0215ed3a0f54823b816fc24d5efa931cd1d55b10","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","v8.6.0","v8.7.0","v8.8.0","v8.9.0","v8.10.0","v8.11.0"],"number":166363,"url":"https://github.com/elastic/kibana/pull/166363","mergeCommit":{"message":"[DOCS]
Adds shards object to Create pack and Update pack API (#166363)\n\n##
Summary\r\n\r\n- Resolves
https://github.com/elastic/security-docs/issues/3822 \r\n\r\nAdds the
`shards` object schema definition to Create pack and Update\r\npack API,
and to the Create pack request example.\r\n\r\n- Related dev PR:
https://github.com/elastic/kibana/pull/166178","sha":"0215ed3a0f54823b816fc24d5efa931cd1d55b10"}},"sourceBranch":"main","suggestedTargetBranches":["8.6","8.7","8.8","8.9","8.10"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166363","number":166363,"mergeCommit":{"message":"[DOCS]
Adds shards object to Create pack and Update pack API (#166363)\n\n##
Summary\r\n\r\n- Resolves
https://github.com/elastic/security-docs/issues/3822 \r\n\r\nAdds the
`shards` object schema definition to Create pack and Update\r\npack API,
and to the Create pack request example.\r\n\r\n- Related dev PR:
https://github.com/elastic/kibana/pull/166178","sha":"0215ed3a0f54823b816fc24d5efa931cd1d55b10"}}]}]
BACKPORT-->
Co-authored-by: natasha-moore-elastic <137783811+natasha-moore-elastic@users.noreply.github.com>
**Bug**
Calling `/api/osquery/saved_queries` with `sortOrder` but without `sort`
field (`/api/osquery/saved_queries?sortOrder=desc`) was causing 500
server error. Same with calls without any parameters
(`/api/osquery/saved_queries`)
**Cause**
We had defaults failover set for `sortOrder` but not for `sort`. Sorting
logic required both fields to be defined. All schema params were set to
optional and we were validating them ourselves.
**Fix**
I've tightened the schema by making all the params required and provided
default values if not provided.
`page: schema.number({ defaultValue: 1 }),
sort: schema.string({ defaultValue: 'id' }),
sortOrder: schema.oneOf([schema.literal('asc'), schema.literal('desc')],
{defaultValue: 'desc',}),`
**Additionally**
Outdated osQuery API docs - `perPage` became `pageSize` and `sortField`
became `sort`. Also, minor spelling fixes.
---------
Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>