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

Project: Fields #78315

Closed
2 of 8 tasks
stacey-gammon opened this issue Sep 23, 2020 · 1 comment
Closed
2 of 8 tasks

Project: Fields #78315

stacey-gammon opened this issue Sep 23, 2020 · 1 comment
Labels
Project:Fields Access field values from fields response, not source Project:RuntimeFields

Comments

@stacey-gammon
Copy link
Contributor

stacey-gammon commented Sep 23, 2020

Project Fields

Access field values using the search fields response, not source.

Intro

It's common for Kibana developers to access field values from _source. This was made very apparent during the runtime fields mapping investigation.

This should be considered an anti-pattern, instead the new fields parameter on search requests should be used.

Differences

There are some differences to be aware of when switching over:

  1. Unmapped fields will not be returned in the fields array (but are in _source).
  2. Runtime fields and field aliases will be returned in the fields array (but are not in _source).
  3. Object arrays are currently flattened. We have an opportunity to change this.
  4. Nested objects are currently flattened but the plan is to unflatten them.
  5. Multi-field sub fields will report values, where as in _source, only the parent field has a value and all sub fields work like empty fields.
  6. Field values may be formatted differently. For example the number "1.5" ingested into source will be returned as "1" if the field is mapped to type long.
  7. TODO: Disabled fields? Disabled fields are returned by source, are they returned in the fields array? This would be a problem, they want them to be displayed. They aren't searchable or filterable, but useful to grab values from them.

TODO: clarification on when _source is appropriate. e.g. drilled into views like in Uptime, Discover "raw" view.

Work items

TODO: get links for these items.

8.0

Starting in 8.0, I think we should consider not returning _source by default because it encourages developers to access field values from it.

@stacey-gammon
Copy link
Contributor Author

Work is complete, closing the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project:Fields Access field values from fields response, not source Project:RuntimeFields
Projects
None yet
Development

No branches or pull requests

1 participant