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

[Maps] create NOT EXISTS filter for tooltip property with no value #62849

Merged
merged 3 commits into from
Apr 9, 2020

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Apr 7, 2020

There is an existing bug when users create a filter in a tooltip for a value that does not exist. The filter creates a match_phrase on null which results in a bad request

Screen Shot 2020-04-07 at 10 54 44 AM

Screen Shot 2020-04-07 at 10 54 35 AM

This PR updates the getESFilters logic to create a negated exists filter when the value does not exist

Screen Shot 2020-04-07 at 12 32 34 PM

@nreese nreese added release_note:fix [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.8.0 labels Apr 7, 2020
@nreese nreese requested a review from thomasneirynck April 7, 2020 18:35
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

Great fix. Really useful because it's now easy to do the inverse too with the include\exclude results toggle

image

const indexPatternField = this._getIndexPatternField();
if (!indexPatternField) {
return [];
}

return [esFilters.buildPhraseFilter(indexPatternField, this.getRawValue(), this._indexPattern)];
const value = this.getRawValue();
if (value == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

== relies on type coercion. maybe value === null || typeof value == 'undefined' instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to leave the check as == null. This is a pretty standard way to check for null, for example, from https://medium.com/javascript-in-plain-english/how-to-check-for-null-in-javascript-dffab64d8ed5 "That means checking for null is one of the few times in JavaScript that using == is recommended, while otherwise === is generally recommended." Additionally, this null check is used all over the Kibana code base. Just search for == null to see its usage.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@nreese nreese merged commit 0dd89e3 into elastic:master Apr 9, 2020
nreese added a commit to nreese/kibana that referenced this pull request Apr 9, 2020
…lastic#62849)

* [Maps] create NOT EXISTS filter for tooltip property with no value

* review feedback
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 9, 2020
…chore/put-all-xjson-together

* 'master' of github.com:elastic/kibana:
  [EPM] Update UI copy to use `integration` (elastic#63077)
  [NP] Inline buildPointSeriesData and buildHierarchicalData dependencies (elastic#61575)
  [Maps] create NOT EXISTS filter for tooltip property with no value (elastic#62849)
  [Endpoint] Add link to Logs UI to the Host Details view (elastic#62852)
  [UI COPY] Fixes typo in max_shingle_size for search_as_you_type (elastic#63071)
  [APM] docs: add alerting examples for APM (elastic#62864)
  [EPM] Change PACKAGES_SAVED_OBJECT_TYPE id (elastic#62818)
  docs: fix rendering of bulleted list (elastic#62855)
  Exposed AddMessageVariables as separate component (elastic#63007)
  Add Data - Adding cloud reset password link to cloud instructions (elastic#62835)
  [ML] DF Analytics:  update memory estimate after adding exclude fields (elastic#62850)
  [Table Vis] Fix visualization overflow (elastic#62630)
  [Endpoint][EPM] Endpoint depending on ingest manager to initialize (elastic#62871)
  [Remote clusters] Fix flaky jest tests (elastic#58768)
  [Discover] Hide time picker when an indexpattern without timefield is selected (elastic#62134)
  Move search source parsing and serializing to data (elastic#59919)
  [ML] Functional tests - stabilize typing in mml input (elastic#63091)
  [data.search.aggs]: Clean up TimeBuckets implementation (elastic#62123)
  [ML] Functional transform tests - stabilize source selection (elastic#63087)
  add embed flag to saved object url as well (elastic#62926)

# Conflicts:
#	x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index.tsx
nreese added a commit that referenced this pull request Apr 9, 2020
…62849) (#63143)

* [Maps] create NOT EXISTS filter for tooltip property with no value

* review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:fix v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants