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

[DataViews] Data view editor allows saving with a blank 'Timestamp field' when editing the index pattern #150219

Closed
davismcphee opened this issue Feb 2, 2023 · 1 comment · Fixed by #150398
Assignees
Labels
bug Fixes for quality problems that affect the customer experience :DataDiscovery/fix-it-week Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.

Comments

@davismcphee
Copy link
Contributor

The data view editor allows saving without setting the Timestamp field (the setting was empty, not set to --- I don't want to use the time filter ---) when editing the index pattern of an existing data view. The result seems to be that it preserves the timestamp field from the previous index pattern, which may be invalid for the new index pattern, and can result in strange behaviour -- for example, the below GIF of Discover. We should either validate that the Timestamp field is set before saving, or auto-update the value to be one of the available options.

Example GIF:
data_view_weirdness

Request after saving:

{
  "index": "kibana_sample_data_ecommerce",
  "body": {
    "sort": [
      {
        "@timestamp": {
          "order": "desc",
          "unmapped_type": "boolean"
        }
      }
    ],
    "fields": [
      {
        "field": "*",
        "include_unmapped": "true"
      },
      {
        "field": "@timestamp",
        "format": "strict_date_optional_time"
      },
      {
        "field": "timestamp",
        "format": "strict_date_optional_time"
      },
      {
        "field": "utc_time",
        "format": "strict_date_optional_time"
      }
    ],
    "size": 500,
    "version": true,
    "script_fields": {},
    "stored_fields": ["*"],
    "runtime_mappings": {},
    "_source": false,
    "query": {
      "bool": {
        "must": [],
        "filter": [
          {
            "range": {
              "@timestamp": {
                "format": "strict_date_optional_time",
                "gte": "2023-01-31T20:00:00.000Z",
                "lte": "2023-02-01T20:07:32.137Z"
              }
            }
          }
        ],
        "should": [],
        "must_not": []
      }
    },
    "highlight": {
      "pre_tags": ["@kibana-highlighted-field@"],
      "post_tags": ["@/kibana-highlighted-field@"],
      "fields": {
        "*": {}
      },
      "fragment_size": 2147483647
    }
  },
  "track_total_hits": false,
  "preference": 1675282018954
}
@davismcphee davismcphee added bug Fixes for quality problems that affect the customer experience loe:small Small Level of Effort Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. :DataDiscovery/fix-it-week labels Feb 2, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

mattkime added a commit that referenced this issue Jun 30, 2023
## Summary

Previously - If you changed a data view's index pattern AND the new
pattern didn't contain the timestamp field, you'd see a blank timestamp
field and it would let you save. The data view would have been saved
with the previous timestamp field which doesn't exist.

Now - The timestamp validator checks to make sure the selected timestamp
field is in the list of available options. This is helpful because it
keeps the previous timestamp value in case you do select an index
pattern that contains it.

Closes: #150219
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Jun 30, 2023
## Summary

Previously - If you changed a data view's index pattern AND the new
pattern didn't contain the timestamp field, you'd see a blank timestamp
field and it would let you save. The data view would have been saved
with the previous timestamp field which doesn't exist.

Now - The timestamp validator checks to make sure the selected timestamp
field is in the list of available options. This is helpful because it
keeps the previous timestamp value in case you do select an index
pattern that contains it.

Closes: elastic#150219
(cherry picked from commit 646539c)
kibanamachine referenced this issue Jun 30, 2023
…#160990)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[data view editor] Fix data view timestamp validation
(#150398)](#150398)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Matthew
Kime","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-30T12:29:44Z","message":"[data
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/150219","sha":"646539c45b454b48c9fa985b7ac5cb69a63c70f8","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Data
Views","Feature:Kibana
Management","Team:DataDiscovery","backport:prev-minor","v8.10.0"],"number":150398,"url":"https://github.com/elastic/kibana/pull/150398","mergeCommit":{"message":"[data
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/150219","sha":"646539c45b454b48c9fa985b7ac5cb69a63c70f8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150398","number":150398,"mergeCommit":{"message":"[data
view editor] Fix data view timestamp validation (#150398)\n\n##
Summary\r\n\r\nPreviously - If you changed a data view's index pattern
AND the new\r\npattern didn't contain the timestamp field, you'd see a
blank timestamp\r\nfield and it would let you save. The data view would
have been saved\r\nwith the previous timestamp field which doesn't
exist.\r\n\r\nNow - The timestamp validator checks to make sure the
selected timestamp\r\nfield is in the list of available options. This is
helpful because it\r\nkeeps the previous timestamp value in case you do
select an index\r\npattern that contains it.\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/150219","sha":"646539c45b454b48c9fa985b7ac5cb69a63c70f8"}}]}]
BACKPORT-->

Co-authored-by: Matthew Kime <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience :DataDiscovery/fix-it-week Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants