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

[Search Source] Do not pick scripted fields if * provided #85133

Merged
merged 5 commits into from
Dec 9, 2020

Conversation

majagrubic
Copy link
Contributor

@majagrubic majagrubic commented Dec 7, 2020

Summary

When building Discover to use Fields API, I noticed the script fields are not displayed. It is because when requesting the fields, I use a wildcard '*', to get all the fields. Scripted fields are initially correctly set in the request body of the search cource, but then there is this filtering according to the field names specified. And since '*' doesn’t correspond to any specific field name, the resulting scripted fields array is empty.

I think a simple solution would be not to this if '*' exists in the fields array.

Checklist

For maintainers

@majagrubic majagrubic marked this pull request as ready for review December 7, 2020 14:05
@majagrubic majagrubic requested a review from a team as a code owner December 7, 2020 14:05
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

Copy link
Contributor Author

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

Looks good and clean, but I can't approve cause I'm one of the contributors.

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Thanks for the update; I missed this use case in my original PR but I think this behavior makes the most sense.

@timroes timroes added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes and removed release_note:roadmap labels Dec 8, 2020
Copy link
Member

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

LGTM. Could we just add a comment here to explain that setting it to * will retrieve all fields (included scripted)?

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Distributable file count

id before after diff
default 46934 47694 +760

Page load bundle

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

id before after diff
data 984.1KB 984.1KB +34.0B

History

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

@timroes timroes merged commit 74bb155 into elastic:master Dec 9, 2020
timroes added a commit to timroes/kibana that referenced this pull request Dec 9, 2020
)

* [Search Source] Do not pick scripted fields if * provided

* Update src/plugins/data/common/search/search_source/search_source.ts

Co-authored-by: Tim Roes <mail@timroes.de>

* Add unit test

* Add documentation

Co-authored-by: Tim Roes <mail@timroes.de>
@majagrubic majagrubic deleted the ssource-scripted-fields branch December 9, 2020 13:05
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 9, 2020
…k-field-to-hot-phase

* 'master' of github.com:elastic/kibana: (429 commits)
  simplify popover open state logic (elastic#85379)
  [Logs UI][Metrics UI] Move actions to the kibana header (elastic#84648)
  [Search Source] Do not pick scripted fields if * provided (elastic#85133)
  [Search] Session SO polling (elastic#84225)
  [Transform] Replace legacy elasticsearch client (elastic#84932)
  [Uptime]Refactor header and action menu (elastic#83779)
  Fix agg select external link (elastic#85380)
  [ILM] Show forcemerge in hot when rollover is searchable snapshot is enabled (elastic#85292)
  clear using keyboard (elastic#85042)
  [GS] add tag and dashboard suggestion results (elastic#85144)
  [ML] API integration tests - skip GetAnomaliesTableData
  Add ECS field for event.code. (elastic#85109)
  [Functional][TSVB] Wait for markdown textarea to be cleaned (elastic#85128)
  skip flaky suite (elastic#62060)
  skip flaky suite (elastic#85098)
  Bump highlight.js to v9.18.5 (elastic#84296)
  Add `server.publicBaseUrl` config (elastic#85075)
  [Alerting & Actions ] More debug logging (elastic#85149)
  [Security Solution][Case] Manual attach alert to a case (elastic#82996)
  Loosen UUID regex to accept uuidv1 or uuidv4 (elastic#85338)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/i18n_texts.ts
#	x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts
timroes pushed a commit that referenced this pull request Dec 9, 2020
…85399)

* [Search Source] Do not pick scripted fields if * provided

* Update src/plugins/data/common/search/search_source/search_source.ts

Co-authored-by: Tim Roes <mail@timroes.de>

* Add unit test

* Add documentation

Co-authored-by: Tim Roes <mail@timroes.de>

Co-authored-by: Maja Grubic <maja.grubic@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants