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

[Discover] Column sort URL parameters are broken in 7.8+ #76705

Closed
lukeelmers opened this issue Sep 3, 2020 · 3 comments · Fixed by #76986
Closed

[Discover] Column sort URL parameters are broken in 7.8+ #76705

lukeelmers opened this issue Sep 3, 2020 · 3 comments · Fixed by #76986
Assignees
Labels
Feature:Discover Discover Application Feature:SharingURLs Short URLs and Share URL features regression Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@lukeelmers
Copy link
Member

Summary

In 6.8 (and possibly later) columns in Discover were sorted based on this URL parameter:
sort:!('@timestamp',desc))

Strangely, in 7.8 and later you need to wrap the sort again to get it to work as expected:
sort:!(!('@timestamp',desc)))

In particular this is an issue for folks who have created short URLs to Discover in 6.8 and updated to 7.8 -- suddenly their sorts are broken.

To Reproduce

  1. Spin up a 6.8.12 cluster in Elastic Cloud
  2. Add two documents in a new index:
PUT test/_doc
{
  "name":"Tobias",
  "age": 34,
  "height": 178,
  "@timestamp": "2020-09-02T19:43:00.000Z"
}

PUT test/_doc
{
  "name":"Kalle",
  "age": 44,
  "height": 158,
  "@timestamp": "2020-09-02T19:40:20.000Z"
}
  1. Create index pattern called test*, Time field set to @timestamp.
  2. Go to discover, add column "age"
  3. Click Share -> Permalinks -> Snapshot -> Short URL -> Copy Link
  4. Paste the url in a text editor. Notice that the url ends with sort:!('@timestamp',desc))
  5. Upgrade the cluster to 7.8.1
  6. Paste the short url in the browser and hit Enter
  7. Add a new column, for example "name".
  8. Click refresh. The posts are now in reversed order. If they are not you can also go to Inspect -> Request and see that sort parameter is empty.
  9. Manually change the sort in the URL to sort:!(!('@timestamp',desc))). Now everything works as it originally did in 6.8.

This issue is also present on 7.9

Workarounds

  1. Creating new short URLs after manually changing the sort as described in 11 above.
  2. An _update_by_query on the .kibana index which is risky and has potential to break all URLs if not done carefully:
POST .kibana/_update_by_query
{
  "script": {
    "source": "ctx._source.url.url = ctx._source.url.url.replace('!(%27@timestamp%27,desc)', '!(!(%27@timestamp%27,desc))')",
    "lang": "painless"
  },
  "query": {
    "match": {
      "type": "url"
    }
  }
}
@lukeelmers lukeelmers added Feature:Discover Discover Application regression triage_needed Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:SharingURLs Short URLs and Share URL features labels Sep 3, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@kertal
Copy link
Member

kertal commented Sep 9, 2020

The reason for the change of the sort parameter is the introduction of multipart in #41918, looking into the details, if that already broke in 7.4 or after

@kertal
Copy link
Member

kertal commented Sep 9, 2020

I can confirm that this broke in 7.4, working on a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application Feature:SharingURLs Short URLs and Share URL features regression Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants