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 field stats for epoch time format #148288
[Discover] Fix field stats for epoch time format #148288
Conversation
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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.
Pulled and tested locally and works as expected, but I think it would be good if we add a test for buildSearchParams
to check the format, or even a simple snapshot test.
@davismcphee Added tests, thanks! |
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @jughosta |
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.
Thanks for the tests! Also the repro steps were super helpful for testing 👍 LGTM
Closes elastic#148140 ## Summary This PR fixes time format so it can work also for epoch. Before: <img width="400" alt="Screenshot 2023-01-03 at 12 33 17" src="https://user-images.githubusercontent.com/1415710/210350243-b3ae1d1a-4c76-46e7-930f-0ca9835dc121.png"> After: <img width="400" alt="Screenshot 2023-01-03 at 12 32 49" src="https://user-images.githubusercontent.com/1415710/210350274-af80f558-6a32-4da6-9cb9-857a8cb3de70.png"> Sample data for testing: ``` PUT test PUT test/_mapping { "properties": { "timestamp": { "type": "date", "format": "epoch_second" }, "message": { "type": "keyword" }, "bytes": { "type": "long" } } } POST test/_doc/1 { "timestamp": 1669912088.9230318, "message": "Message 1", "bytes": 250 } POST test/_doc/2 { "timestamp": 1669912088.9230319, "message": "Message 2", "bytes": 20 } ``` (cherry picked from commit 1b3769c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…8457) # Backport This will backport the following commits from `main` to `8.6`: - [[Discover] Fix field stats for epoch time format (#148288)](#148288) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2023-01-05T14:52:29Z","message":"[Discover] Fix field stats for epoch time format (#148288)\n\nCloses #148140 Summary\r\n\r\nThis PR fixes time format so it can work also for epoch.\r\n\r\nBefore:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 33 17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350243-b3ae1d1a-4c76-46e7-930f-0ca9835dc121.png\">\r\n\r\nAfter:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 32 49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350274-af80f558-6a32-4da6-9cb9-857a8cb3de70.png\">\r\n\r\nSample data for testing:\r\n```\r\nPUT test\r\nPUT test/_mapping\r\n{\r\n \"properties\": {\r\n \"timestamp\": {\r\n \"type\": \"date\",\r\n \"format\": \"epoch_second\"\r\n },\r\n \"message\": {\r\n \"type\": \"keyword\"\r\n },\r\n \"bytes\": {\r\n \"type\": \"long\"\r\n }\r\n }\r\n}\r\n \r\nPOST test/_doc/1\r\n{\r\n \"timestamp\": 1669912088.9230318,\r\n \"message\": \"Message 1\",\r\n \"bytes\": 250\r\n}\r\nPOST test/_doc/2\r\n{\r\n \"timestamp\": 1669912088.9230319,\r\n \"message\": \"Message 2\",\r\n \"bytes\": 20\r\n}\r\n```","sha":"1b3769c86b683a3e1762f23b6f503479957044c6","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:prev-minor","Feature:UnifiedFieldList","v8.7.0"],"number":148288,"url":"#148288 Fix field stats for epoch time format (#148288)\n\nCloses #148140 Summary\r\n\r\nThis PR fixes time format so it can work also for epoch.\r\n\r\nBefore:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 33 17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350243-b3ae1d1a-4c76-46e7-930f-0ca9835dc121.png\">\r\n\r\nAfter:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 32 49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350274-af80f558-6a32-4da6-9cb9-857a8cb3de70.png\">\r\n\r\nSample data for testing:\r\n```\r\nPUT test\r\nPUT test/_mapping\r\n{\r\n \"properties\": {\r\n \"timestamp\": {\r\n \"type\": \"date\",\r\n \"format\": \"epoch_second\"\r\n },\r\n \"message\": {\r\n \"type\": \"keyword\"\r\n },\r\n \"bytes\": {\r\n \"type\": \"long\"\r\n }\r\n }\r\n}\r\n \r\nPOST test/_doc/1\r\n{\r\n \"timestamp\": 1669912088.9230318,\r\n \"message\": \"Message 1\",\r\n \"bytes\": 250\r\n}\r\nPOST test/_doc/2\r\n{\r\n \"timestamp\": 1669912088.9230319,\r\n \"message\": \"Message 2\",\r\n \"bytes\": 20\r\n}\r\n```","sha":"1b3769c86b683a3e1762f23b6f503479957044c6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"#148288 Fix field stats for epoch time format (#148288)\n\nCloses #148140 Summary\r\n\r\nThis PR fixes time format so it can work also for epoch.\r\n\r\nBefore:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 33 17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350243-b3ae1d1a-4c76-46e7-930f-0ca9835dc121.png\">\r\n\r\nAfter:\r\n<img width=\"400\" alt=\"Screenshot 2023-01-03 at 12 32 49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/210350274-af80f558-6a32-4da6-9cb9-857a8cb3de70.png\">\r\n\r\nSample data for testing:\r\n```\r\nPUT test\r\nPUT test/_mapping\r\n{\r\n \"properties\": {\r\n \"timestamp\": {\r\n \"type\": \"date\",\r\n \"format\": \"epoch_second\"\r\n },\r\n \"message\": {\r\n \"type\": \"keyword\"\r\n },\r\n \"bytes\": {\r\n \"type\": \"long\"\r\n }\r\n }\r\n}\r\n \r\nPOST test/_doc/1\r\n{\r\n \"timestamp\": 1669912088.9230318,\r\n \"message\": \"Message 1\",\r\n \"bytes\": 250\r\n}\r\nPOST test/_doc/2\r\n{\r\n \"timestamp\": 1669912088.9230319,\r\n \"message\": \"Message 2\",\r\n \"bytes\": 20\r\n}\r\n```","sha":"1b3769c86b683a3e1762f23b6f503479957044c6"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
The backport was not included on |
Closes #148140
Summary
This PR fixes time format so it can work also for epoch.
Before:
After:
Sample data for testing: