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

[Security Solution] [142435] add is one of operator #144988

Merged
merged 38 commits into from
Nov 16, 2022

Conversation

jamster10
Copy link
Contributor

@jamster10 jamster10 commented Nov 10, 2022

Summary

This PR adds support for an is one of operator allowing users to filter multiple values for one field.

Some investigation by @andrew-goldstein revealed that since the underlying engine uses Lucene, we can add support for multiple values by using an OR query:

kibana.alert.workflow_status: ("open" OR "closed" OR "acknowledged") is equivalent to

"terms": {
      "kibana.alert.workflow_status": [ "open", "closed", "acknowledged"]
    }

Where the former is usable in our DataProviders used by timeline and other components that navigate a user to a pre-populated timeline.

As an enhancement to the timeline view, users can also use this is one of operator by interacting with the Add field button and selecting the new operator.

image

Checklist

Delete any items that are not applicable to this PR.

Known issues

This operator does not support timeline templates at this time so usage there disables the ability for conversion to template field but a better approach should be implemented to notify users. #142437. For now I have added a template message and prevented users from creating templates with this operator:

image

Testing

Create a new timeline or visit an existing one.
Click 'Add field' button on Timeline in OR query section
add any field ( preferably one that can have many values- consider kibana.alerts.workflow_status but this requires alerts.
Select the is one of or is not one of operator
Add or remove values in the value section.
Click save.

@jamster10 jamster10 changed the title 142435 add is one of operstor 142435 add is one of operator Nov 10, 2022
@jamster10 jamster10 marked this pull request as ready for review November 14, 2022 14:26
@jamster10 jamster10 requested review from a team as code owners November 14, 2022 14:26
@jamster10 jamster10 self-assigned this Nov 14, 2022
@jamster10 jamster10 added enhancement New value added to drive a business result Team:Threat Hunting Security Solution Threat Hunting Team labels Nov 14, 2022
Copy link
Contributor

@andrew-goldstein andrew-goldstein left a comment

Choose a reason for hiding this comment

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

@jamster10 thanks for enhancing Timeline's Data Providers to implement the is one of and is not one of operators! 🙏

  • For users, this feature adds additional expressiveness to Timeline's query builder
  • For developers, existing Investigate in timeline actions may, pending addtional support for overriding labels, integrate with this feature to use Data Providers instead of filters

Desk tested locally

LGTM 🚀

@jamster10 jamster10 enabled auto-merge (squash) November 16, 2022 02:10
@jamster10 jamster10 changed the title 142435 add is one of operator [Security Solution] [142435] add is one of operator Nov 16, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 3302 3305 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 9.7MB 9.7MB -300.0B
timelines 74.7KB 74.7KB -4.0B
total -304.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
timelines 139.0KB 139.8KB +816.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 59 65 +6
osquery 108 113 +5
securitySolution 441 447 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 67 73 +6
osquery 109 115 +6
securitySolution 518 524 +6
total +20

History

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

cc @jamster10

@jamster10 jamster10 merged commit 7ac6561 into elastic:main Nov 16, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 16, 2022
benakansara pushed a commit to benakansara/kibana that referenced this pull request Nov 17, 2022
## Summary

This PR adds support for an is one of operator allowing users to filter
multiple values for one field.

[Some investigation
](https://discuss.elastic.co/t/passing-multiple-values-in-kibana-add-filter-is-one-of/232694/2)by
@andrew-goldstein revealed that since the underlying engine uses Lucene,
we can add support for multiple values by using an OR query:

`kibana.alert.workflow_status: ("open" OR "closed" OR "acknowledged")`
is equivalent to
```
"terms": {
      "kibana.alert.workflow_status": [ "open", "closed", "acknowledged"]
    }
```
Where the former is usable in our `DataProviders` used by timeline and
other components that navigate a user to a pre-populated timeline.

As an enhancement to the timeline view, users can also use this `is one
of` operator by interacting with the `Add field` button and selecting
the new operator.

<img width="433" alt="image"
src="https://user-images.githubusercontent.com/28942857/193487154-769005b6-3e5a-40bf-9476-8dd3f3bcb8ee.png">

### Checklist

Delete any items that are not applicable to this PR.

- [X] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [X] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios


## Known issues
This operator does not support timeline templates at this time so usage
there disables the ability for conversion to template field but a better
approach should be implemented to notify users.
elastic#142437. For now I have added a
template message and prevented users from creating templates with this
operator:

<img width="374" alt="image"
src="https://user-images.githubusercontent.com/28942857/201157676-80017c6c-9f5b-4cd7-ba0b-ee2e43a884cb.png">



## Testing
Create a new timeline or visit an existing one. 
Click 'Add field' button on Timeline in OR query section
add any field ( preferably one that can have many values- consider
`kibana.alerts.workflow_status` but this requires alerts.
Select the `is one of` or `is not one of operator`
Add or remove values in the value section.
Click save.

Co-authored-by: Kristof-Pierre Cummings <kristofpierre.cummings@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting enhancement New value added to drive a business result release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Explore Team:Threat Hunting:Investigations Security Solution Investigations Team Team:Threat Hunting Security Solution Threat Hunting Team v8.6.0
Projects
None yet
7 participants