- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.5k
[Discover] Fix context view for date_nanos format with custom timestamps #54089
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
[Discover] Fix context view for date_nanos format with custom timestamps #54089
Conversation
1937102    to
    fc0f2f2      
    Compare
  
    …-20-context-custom-timestamp-fix
| @elasticmachine merge upstream | 
| @elasticmachine merge upstream | 
| @elasticmachine merge upstream | 
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.
Code change looks good to me and I tested the functionality in Chrome. Had one question about the tests that were changed.
        
          
                src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/get_sort.js
          
            Show resolved
            Hide resolved
        
      …-20-context-custom-timestamp-fix
…ithub.com:kertal/kibana into kertal-pr-2019-12-20-context-custom-timestamp-fix
| 💚 Build SucceededHistory
 To update your PR or re-run it, just comment with: | 
| Pinging @elastic/kibana-app (Team:KibanaApp) | 
…mps (elastic#54089) * Switch from _source to fields when fetching anchor records with date_nanos timestamps * Add testdata * Add functional test
…mps (elastic#54089) * Switch from _source to fields when fetching anchor records with date_nanos timestamps * Add testdata * Add functional test
…mps (elastic#54089) * Switch from _source to fields when fetching anchor records with date_nanos timestamps * Add testdata * Add functional test
* Discover: Add handling for source column (#91815) * enable by default * [Discover] Fix context view for date_nanos format with custom timestamps (#54089) * Switch from _source to fields when fetching anchor records with date_nanos timestamps * Add testdata * Add functional test * fix search_after Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Matthias Wilhelm <[email protected]>
Summary
Discover's context view currently doesn't work when you're using a custom formatted
date_nanostimestamp like this:{ "type" : "date_nanos", "format" : "yyyy-MM-dd HH:mm:ss.SSSSSS" }.We're currently using the timestamp stored in
_sourceto provide the context functionality withdate_nanostimestamps, which is due to the limited support of BigInt support of Browsers. If the _source value is formatted in a non standard way, the conversion to a Date Object may fail. This fix switches from the value stored in _source to the value provided byfieldsof the search result.This contains a
strict_date_timeformatted string, so there are no more problems with custom timestamp formatsFixes #48064
Testing
You can use the following data to test the fix:
Before the fix:
After the fix:

Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately