-
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
[App Search] Fixed Documents view for Editor and Analyst roles #103113
Conversation
1.6.0 adds the ability to authenticate without a search key, which we need for this fix.
This change updates the page to rely on basic authentication rather than a search key. As part of that, we needed to create a proxy endpoint for search-ui to post to, rather than going directly to the ent-search API.
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.
Pulling this down for a quick QA and then approving! Awesome work!
@@ -52,7 +52,8 @@ const DEFAULT_SORT_OPTIONS: SortOption[] = [ | |||
|
|||
export const SearchExperience: React.FC = () => { | |||
const { engine } = useValues(EngineLogic); | |||
const endpointBase = externalUrl.enterpriseSearchUrl; | |||
const { http } = useValues(HttpLogic); | |||
const endpointBase = http.basePath.prepend('/api/app_search/search-ui'); |
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.
nice find on this! 💯
additionalHeaders: { | ||
'kbn-xsrf': true, | ||
}, |
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.
Similarly awesome find, hope this wasn't a huge headache to figure out 🤔
// Search UI *also* uses the click tracking and query suggestion endpoints, however, since the | ||
// App Search plugin doesn't use that portion of Search UI, we only set up a proxy for the search endpoint below. |
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.
Sorry, I think my brain's a little fried this morning but just want to confirm I'm understanding this comment. By us not explicitly providing the click tracking and query suggestion routes in this PR, Search UI will no longer hit those endpoints. Is that correct?
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.
From my own testing:
- It looks like Analytics search/query events are still getting logged
- However, Analytics click events are not getting logged, leading to inaccurate Analytics results when only using the dashboard
- It also it looks like API events are no longer getting logged, although this could be my local behaving strangely
@JasonStoltz I think the click event thing is potentially a blocker unfortunately, it prevents us from QAing Analytics accurately using the Documents view (important for things like E2E testing also). Is there any way we can update Search UI to either track clicks again, or (another option if that's easier) to completely not affect Analytics whatsoever?
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.
Just want to add also: I personally don't think this fix needs to get in by 7.14FF (or it's also OK if we take a little longer and get it in past FF, since it's a bugfix). It's been broken on ent-search for several minors now, and this is shipping as a beta UI, so comes with even less support - so I'm OK taking a little longer to figure this out for the long term and to help solidify our E2E tests.
This may even be a decent time also to discuss/address the tech debt item we've discussed in the past about whether dashboard API calls should count towards Analytics/API events or not.
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.
Sorry, I think my brain's a little fried this morning but just want to confirm I'm understanding this comment. By us not explicitly providing the click tracking and query suggestion routes in this PR, Search UI will no longer hit those endpoints. Is that correct?
Documents view is not configured to use click tracking or query suggestions. Since it never hits those endpoints, we do not need to create proxy endpoints here.
It looks like Analytics search/query events are still getting logged
We should fix this, I don't think they should be logged
However, Analytics click events are not getting logged, leading to inaccurate Analytics results when only using the dashboard
I think the endgame is to not log any of these queries or clicks.
It also it looks like API events are no longer getting logged, although this could be my local behaving strangely
I don't know anything about that.
I think the click event thing is potentially a blocker unfortunately, it prevents us from QAing Analytics accurately using the Documents view (important for things like E2E testing also).
That behavior isn't introduced in this PR, so I don't think this is a blocker for this PR. It is a separate issue entirely.
Is there any way we can update Search UI to either track clicks again, or (another option if that's easier) to completely not affect Analytics whatsoever?
I think the answer is the latter. Any views in the Dashboard that hit the search endpoint Query Tester, Curations, Documents View ... none of them should be logging Analytics events, they don't provide any value to the user. This is something we discussed as part of the Search UI view transition.
I'd propose a simple header that indicates "this request should not be tracked".
Just want to add also: I personally don't think this fix needs to get in by 7.14FF (or it's also OK if we take a little longer and get it in past FF, since it's a bugfix). It's been broken on ent-search for several minors now, and this is shipping as a beta UI, so comes with even less support - so I'm OK taking a little longer to figure this out for the long term and to help solidify our E2E tests.
Just highlighting again that this PR is completely decoupled from that issue. If we want to enable click tracking we can, we just need to add a proxy endpoint for the click API route.
I think we should get this merged and fixed and handle analytics separately. I'm happy to create an issue for it in our backlog.
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.
That behavior isn't introduced in this PR, so I don't think this is a blocker for this PR. It is a separate issue entirely.
To be clear, it is introduced by this PR (I'm not sure why though). It's not a separate issue unfortunately.
On Kibana master and on ent-search, you can do the following:
- Go to the Documents view
- Type in "park" (or any search that has results)
- Click on any document
- Go to Analytics
- Confirm that your "park" query shows up in Analytics in "Top queries" and in "Top queries with clicks" indicating that the click event triggered
On this branch, if you repeat the above 4 steps the "Top queries with clicks" panel does not update, indicating that click events stopped being recorded.
Unfortunately, even if this is a side effect of this PR, it's not one I feel 100% comfortable creating so close to FF since it's a distinct deviation from how ent-search currently behaves. FWIW, I do agree the best long term solution is to not have any dashboard actions show up in either Analytics or API logs - I'd just like to take the extra effort to get that in if possible 🤔
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 we should get this merged and fixed and handle analytics separately. I'm happy to create an issue for it in our backlog.
Sorry, should have addressed this too. I'm OK with merging this in now only if we commit to fully handling (i.e., ignoring) dashboard analytics before 7.14 (so I guess after FF but before release). Otherwise, I think we should wait for 7.15. I really really worry about releasing this to 7.14 with an entire Analytics category (queries with clicks) incorrectly affected by our own dashboard in a way that it has not done so previously.
Would definitely appreciate it if you could try to repro my above steps and confirm behavior in master vs this branch! If I'm totally wrong about what's happening and click events are still being logged, then I'm GTG on 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.
I cannot reproduce.
Both on master kibana and this branch, clicking on a link will not send click data.
Inspect the network tab and you'll see for yourself, no API call is being made.
We did track these clicks in ent-search.
We do not, and never have tracked click analytics in the Documents view within Kibana. This PR does not change that. It doesn't prevent us from doing it in the future either. This PR is completely decoupled from your Analytics concern.
Whether we merge this PR or don't, it has no impact on Analytics.
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.
Gah, yup, you're totally right. I just tried again on Kibana master with a fresh instance and clicks aren't showing up. Not sure if I was in a horrible fever dream, if my local elasticsearch instance got messed up, or if I got confused with ent-search
😰 (or all of the above?)
Thanks so much for taking the extra time to repro and confirm for me, I really appreciate that. Going to ahead and approve, and bring up filtering out dashboard analytics at next week's sync
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.
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.
Haha, thanks for calling it out. Better to call it out and be wrong than say nothing.
We can definitely solve this Analytics thing. Maybe just enable click analytics for 7.14 and remove all analytics for 7.15.
// App Search plugin doesn't use that portion of Search UI, we only set up a proxy for the search endpoint below. | ||
router.post( | ||
skipBodyValidation({ | ||
path: '/api/app_search/search-ui/api/as/v1/engines/{engineName}/search.json', |
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.
Actually sorry, just wanted to leave a comment on this: do we really need to version this or make it look exactly like AS's endpoint? Any thoughts on
path: '/api/app_search/search-ui/api/as/v1/engines/{engineName}/search.json', | |
path: '/api/app_search/engines/{engineName}/search-ui/search.json', |
Instead to better match our other Kibana API endpoints?
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.
Sorry, I wondered if my comment above wasn't clear, I think this is evidence that it was not.
Search UI always posts its search query to:
{whatever base path you provide in configuration}/api/as/v1/engines/{engineName}/search.json
.
EDIT: So yes, the last part of this path DOES need to match exactly, unfortunately.
I could update Search UI and the javascript client to accept a full path as configuration, and not just the base path, but that would be the long fix. I didn't anticipate this issue the last time I updated search-ui.
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.
Ohhh gotcha gotcha. No worries in that case, my bad for failing to understand!
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.
It's not your bad, it's mine for poor writing 😢
@elasticmachine merge upstream |
@elasticmachine merge upstream |
CI seemed to be hanging, so I gave it the ol' razzle dazzle |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…ic#103113) * Updated search-ui version 1.6.0 adds the ability to authenticate without a search key, which we need for this fix. * Updated Documents page to not use a search key This change updates the page to rely on basic authentication rather than a search key. As part of that, we needed to create a proxy endpoint for search-ui to post to, rather than going directly to the ent-search API. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…) (#103204) * Updated search-ui version 1.6.0 adds the ability to authenticate without a search key, which we need for this fix. * Updated Documents page to not use a search key This change updates the page to rely on basic authentication rather than a search key. As part of that, we needed to create a proxy endpoint for search-ui to post to, rather than going directly to the ent-search API. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Jason Stoltzfus <jastoltz24@gmail.com>
Summary
This change updates the Documents view search to rely on basic authentication rather than a search key.
As part of that, we needed to create a proxy endpoint for search-ui, rather than going directly to the ent-search API.
I updated to search-ui 1.6.0, which adds the ability to use basic auth, which we need for this fix.
For maintainers