-
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
[Security Solution] Remove fields
from sourcerer response
#130917
Conversation
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
@@ -26,6 +26,13 @@ jest.mock('./helpers', () => { | |||
}); | |||
const mockPattern = { | |||
id: 'security-solution', | |||
fields: [ |
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.
adding fields to mock response to ensure they are not returned
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@@ -90,6 +82,7 @@ export const createSourcererDataViewRoute = ( | |||
} | |||
} | |||
} else if (patternListAsTitle !== siemDataViewTitle) { | |||
siemDataView = await dataViewService.get(dataViewId); |
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.
We can get to this line only if siemDataView
is not null, so I didn't understand the logic, why we need to reassign the new value fetched from dataViewService
to siemDataView
, is there any purpose for this?
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.
yes, unfortunately to make the dataViewService.updateSavedObject
call we need to pass the entire data view object including fields 😢
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.
@stephmilovic is this still true? From the docs it says Update part of an data view. Only the specified fields are updated in the data view. Unspecified fields stay as they are persisted.
. Are we just looking to update title here?
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.
@yctercero unfortunately, if we do not do the GET call we do not get the saved object methods. It's kind of silly, they should really fetch it on their end. But alas, sending only id and title to dataViewService.updateSavedObject
results in
error TypeError: indexPattern.getAsSavedObjectBody is not a function
at DataViewsService.updateSavedObject (/Users/stephmilovic/dev/kibana/src/plugins/data_views/common/data_views/data_views.ts:665:31)
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.
Thanks for the follow-up Steph! That stinks...
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
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
⚪ Backport skippedThe pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
Summary
We were unnecessarily returning
fields
with sourcerer. This PR removes unnecessary calls todataViews.get
and ensures onlyid
,patternList
, andtitle
are returnedBrings down the response time for the sourcerer call from about 3.5 seconds to .7 seconds