-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Cases] Restrict searchFields, sortField and remove rootSearchFields from find_cases API #162245
[Cases] Restrict searchFields, sortField and remove rootSearchFields from find_cases API #162245
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I left a comment about searching by the case ID. We should keep this functionality and not remove it.
x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts
Show resolved
Hide resolved
@@ -35,7 +35,6 @@ type FindOptions = Pick< | |||
| 'searchFields' | |||
| 'sortField' | |||
| 'sortOrder' | |||
| 'rootSearchFields' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is needed because is used by SavedObjectFindOptionsKueryNode
and the results of constructSearch
is being passed to functions that use the SavedObjectFindOptionsKueryNode
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh, this common for all services and not only for find cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Tested locally and the search by case ID and the sorting is working as expected.
@@ -394,7 +394,7 @@ export default ({ getService }: FtrProviderContext): void => { | |||
expect(cases.cases[0].title).to.equal(uuid); | |||
}); | |||
|
|||
it('should successfully find a case with a valid uuid in title', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why were these two tests with the same name not throwing a listing error!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea why 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 🔥
💛 Build succeeded, but was flaky
Failed CI Steps
Test Failures
Metrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explore changes LGTM!
…from find_cases API (elastic#162245) ## Summary This PR modifies` find_cases API` with below changes - [x] Restrict `searchFields` only to the `title` and the `description` - [x] Restrict `sortField` to: `title`, `category`, `createdAt`, `updatedAt`, `status`, and `severity` - [x] Remove `rootSearchFields` ### Checklist Delete any items that are not applicable to this PR. - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: kibanamachine <[email protected]>
Summary
This PR modifies
find_cases API
with below changessearchFields
only to thetitle
and thedescription
sortField
to:title
,category
,createdAt
,updatedAt
,status
, andseverity
rootSearchFields
Checklist
Delete any items that are not applicable to this PR.
For maintainers