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

[Discover] Suppress error when popularizeField fails #62402

Conversation

kertal
Copy link
Member

@kertal kertal commented Apr 3, 2020

Summary

Simple fix how to prevent HTTP 409 when adding fields in Discover. Every time you add or remove a field, the count value of the field is increased and the index pattern is persisted. This causes a 409 when the recent persistence hasn't finished. This PR suppresses the exception in this case. This solves the issue for the user, however technically it would be a better solution to prevent the exception like here #46566.

This is a very old problem, here's a screenshot of Kibana 6.x

Fixes #22426

@kertal kertal requested a review from lizozom April 3, 2020 10:16
@kertal
Copy link
Member Author

kertal commented Apr 6, 2020

dear @lizozom , before I continue here, do you think this is a valid way to go? since it contains a core API change, thx!

@kertal kertal self-assigned this Apr 6, 2020
@lizozom
Copy link
Contributor

lizozom commented Apr 6, 2020

@kertal Well, as this fix only hides the error message and changes an API, I'd say the other solution seems better. What do you think?

@kertal
Copy link
Member Author

kertal commented Apr 6, 2020

@kertal Well, as this fix only hides the error message and changes an API, I'd say the other solution seems better. What do you think?

@lizozom agreed, so I can see 3 quick options as alternative

  1. adding the option to the API, but if throwError is true (default: false), the function throws an Exception, so it's up to the consumer how to handle it (so popularize could just catch it)
  2. popularize takes care of saving, doesn't use the save function
  3. let it be for now

@kertal kertal force-pushed the kertal-pe-2020-04-03-suppress-popularizeField-error branch from c59ff11 to 63fa09a Compare May 14, 2020 07:11
@kertal kertal requested a review from streamich May 14, 2020 07:12
@kertal
Copy link
Member Author

kertal commented May 14, 2020

adding @streamich to discuss, who also complained about this error. @lizozom I've implemented the approach popularize takes care of saving, doesn't use the save function, what do you think?

@kertal kertal added Feature:Discover Discover Application Feature:Data Views Data Views code and UI - index patterns before 8.0 labels May 14, 2020
Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Code LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kertal kertal marked this pull request as ready for review May 14, 2020 14:32
@kertal kertal requested a review from a team as a code owner May 14, 2020 14:32
@kertal kertal merged commit 02a2d07 into elastic:master May 14, 2020
kertal added a commit to kertal/kibana that referenced this pull request May 14, 2020
* Refactor index_patterns popularize function, so no message is displayed to the user
# Conflicts:
#	src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts
kertal added a commit to kertal/kibana that referenced this pull request May 14, 2020
* Refactor index_patterns popularize function, so no message is displayed to the user
# Conflicts:
#	src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Discover Discover Application release_note:fix v7.8.0 v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occasional HTTP 409 responses while adding fields in Discover
4 participants