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

Move indexPattern.popularizeField into discover #77668

Merged
merged 16 commits into from
Sep 30, 2020

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Sep 16, 2020

Summary

Move indexPattern.popularizeField into discover which is the only app where its used. Part of Index
Pattern api simplification - #69379

Checklist

@mattkime mattkime changed the title Move popularize to discover Move indexPattern.popularizeField into discover Sep 16, 2020
@mattkime mattkime added Team:AppArch Feature:Data Views Data Views code and UI - index patterns before 8.0 v8.0.0 v7.10.0 release_note:skip Skip the PR/issue when compiling release notes labels Sep 16, 2020
@@ -221,6 +221,7 @@ export class SearchEmbeddable
if (!searchScope.columns) {
return;
}
throw new Error('test error - searchscope');
indexPattern.popularizeField(columnName, 1);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not aware of a way to add columns in the embeddable? while we may keep this code unless we're 100% sure, I don't think we should keep popularize

@mattkime mattkime mentioned this pull request Sep 24, 2020
63 tasks
@mattkime mattkime marked this pull request as ready for review September 27, 2020 04:37
@mattkime mattkime requested a review from a team September 27, 2020 04:37
@mattkime mattkime requested a review from a team as a code owner September 27, 2020 04:37
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

Copy link
Member

@ppisljar ppisljar 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

Copy link
Member

@kertal kertal 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, nice cleanup 👍. Added some minor remarks. Tested locally in Safari, Firefox, Chrome, works , values are increased, and no errors is displayed when this is done too fast. One last think that would make it perfect: Could you add a unit test for the popularize function? many thx!

Comment on lines 59 to 63
try {
const indexPattern = await indexPatterns.get(indexPatternId);
await popularizeField(indexPattern, field.name, indexPatterns);
// eslint-disable-next-line no-empty
} catch {}
Copy link
Member

Choose a reason for hiding this comment

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

Since the popularizeField function doesn't throw an Exception, I think you don't need to try{}catch{} here

}

field.count++;
await indexPatternsService.updateSavedObject(indexPattern, 0, true).catch();
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest adding some context why exceptions are automatically caught like

Suggested change
await indexPatternsService.updateSavedObject(indexPattern, 0, true).catch();
// Catch 409 errors caused by user adding columns in a higher frequency that the changes can be persisted to Elasticsearch
await indexPatternsService.updateSavedObject(indexPattern, 0, true).catch();

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/optimizer bundle module count

id value diff baseline
discover 241 +1 240

async chunks size

id value diff baseline
discover 433.1KB +1.9KB 431.2KB

page load bundle size

id value diff baseline
data 1.3MB -1.1KB 1.3MB

History

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

@mattkime mattkime merged commit cdb922f into elastic:master Sep 30, 2020
mattkime added a commit to mattkime/kibana that referenced this pull request Sep 30, 2020
Move indexPattern.popularizeField into discover
# Conflicts:
#	docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md
#	docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternsservice.md
#	docs/development/plugins/data/server/kibana-plugin-plugins-data-server.indexpattern.md
mattkime added a commit that referenced this pull request Sep 30, 2020
Move indexPattern.popularizeField into discover
phillipb added a commit to phillipb/kibana that referenced this pull request Sep 30, 2020
…aly-detection-partition-field

* 'master' of github.com:elastic/kibana: (37 commits)
  [UiActions] Don't throw an error if there are no compatible actions to execute (elastic#78917)
  [Observability] Kibana nav when docked overlaps the content of the pages. (elastic#78593)
  Invalid `searchSourceJSON` causes saved object migration to fail (elastic#78535)
  update vega version (elastic#78390)
  Fix warning text doesn't get displayed on filters with custom filter name (elastic#78617)
  [ILM] Data tier notices should reflect tier preferences (elastic#78398)
  [APM] Service Map: `Not Defined` option doesn't work properly (elastic#77757)
  Improve invalid field error message at search.aggs.param_types.field (elastic#78587)
  Remove isDeprecated flag on visType (elastic#78820)
  Remove unused elasticsearch.preserverHost setting (elastic#78608)
  Fix condition and adjust tests (elastic#78898)
  [UX] Add percentile selector (elastic#78562)
  [ML] Replace use of rest_total_hits_as_int with track_total_hits (elastic#78423)
  expression service docs (elastic#78774)
  [Functional] Wait for the page to load and then click the new vis button (elastic#78725)
  [TSVB] No data in visualizations with annotations (elastic#78794)
  [kbn/ui-shared-deps] track asset sizes (elastic#78718)
  delete target before building (elastic#78665)
  Move indexPattern.popularizeField into discover (elastic#77668)
  [Security Solution][Resolver]Add backdrop to pills (elastic#78625)
  ...
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 release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants