-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Maps] Add support for date fields in dynamic styles #47903
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
Conversation
…kibana into dynamic-style-time
|
Pinging @elastic/kibana-gis (Team:Geo) |
| }); | ||
|
|
||
| return [...numberFieldOptions, ...joinFields]; | ||
| return [...timeFieldOptions, ...numberFieldOptions, ...joinFields]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this list time fields list before number fields in the UI? (Or is there something else sorting them later?) 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The list in the dropdown appears to be alphabetical by field label.
|
Love this feature and think it will be really useful! |
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
| const { supportsFeatureState, isScaled, name, range, computedName } = styleFields[j]; | ||
| const value = parseFloat(feature.properties[name]); | ||
| //Date fields pulled from doc_values is an array of epoch_millis and a date string | ||
| const value = Array.isArray(feature.properties[name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move the logic for extracting date fields out of VectorStyle which is generic and should not have source specific details. You can put the logic into hitsToGeoJson
| const initialSearchContext = { | ||
| docvalue_fields: searchFilters.fieldNames | ||
| }; | ||
| initialSearchContext.docvalue_fields.push(...searchFilters.fieldNames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The time field is getting included in docvalue_fields twice. Below is an example request. To prevent this, filter searchFilters.fieldNames to exclude time fields since they are already in docvalue_fields.
"docvalue_fields": [
{
"field": "@timestamp",
"format": "epoch_millis"
},
"@timestamp",
"geo.coordinates"
],
💚 Build Succeeded |
|
Currently this allows you to link symbol orientation to a date field (anecdotally it seems all icons are oriented at 0 degrees though). Unless we have a clear rationale for mapping date to orientation (🤔?), we may want to exclude dates there. |
💔 Build Failed |
use new Fields syntax, simplify docvalue_fields creation
💚 Build Succeeded |
nreese
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
code review, tested in chrome
* [Maps] retrieve geo_point value from docvalue_fields instead of _source * [Maps] retrieve geo_point value from docvalue_fields instead of _source * Dynamically style by time field * Add epoch_millis to date fields in docvalues * add functional test ensuring _search request only pulls what is needed * Add functional test for dynamic styles by date field * Support dynamic styles in top hits agg * Add getTimeFields fn to vector_source * Retrieve only epoch_millis for date fields in docvalues * use new Fields syntax, simplify docvalue_fields creation * fix comment
|
7.x #48295 |
|
💥💥💥 |
* [Maps] retrieve geo_point value from docvalue_fields instead of _source * [Maps] retrieve geo_point value from docvalue_fields instead of _source * Dynamically style by time field * Add epoch_millis to date fields in docvalues * add functional test ensuring _search request only pulls what is needed * Add functional test for dynamic styles by date field * Support dynamic styles in top hits agg * Add getTimeFields fn to vector_source * Retrieve only epoch_millis for date fields in docvalues * use new Fields syntax, simplify docvalue_fields creation * fix comment


Summary
Fixes #39219. This adds date fields to the supported fields for dynamic styles in the maps app.
For example, this screenshot shows the most recent five locations of an airplane in flight. The older locations are smaller and lighter colored than more recent locations.
This builds upon the work in PR #47389. Ideally, we could merge that PR first.