OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[BUG] Timefield (global state) is not captured when migrate url for Discover from 2.9 to 2.11

Open ananzh opened this issue 1 year ago • 0 comments

Describe the bug

When clicks a legacy discover url, it redirect to new URL with data_explorer parameter. But timefield is not set , it only shows the last 15minutes in the timefield filter section. Here is a url from 2.9:

/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'2024-04-03T03:30:00.000Z',to:'2024-05-03T04:30:00.000Z'))&_a=(columns:!(_source),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,key:category.keyword,negate:!t,params:(query:'Men!'s%20Clothing'),type:phrase),query:(match_phrase:(category.keyword:'Men!'s%20Clothing'))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,key:currency,negate:!f,params:(query:EUR),type:phrase),query:(match_phrase:(currency:EUR)))),index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,interval:auto,query:(language:kuery,query:''),sort:!()) 

It will become

/app/data-explorer/discover/#?_a=(discover:(columns:!(_source),interval:auto,sort:!()),metadata:(indexPattern:ff959d40-b880-11e8-a6d9-e546fe2bba5f,view:discover),vis-builder-editor:(errors:(),savedVisBuilderId:'',status:loading),vis-builder-style:(),vis-builder-ui:(),vis-builder-visualization:(searchField:''))&_q=(filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,key:category.keyword,negate:!t,params:(query:'Men!'s%20Clothing'),type:phrase),query:(match_phrase:(category.keyword:'Men!'s%20Clothing'))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:ff959d40-b880-11e8-a6d9-e546fe2bba5f,key:currency,negate:!f,params:(query:EUR),type:phrase),query:(match_phrase:(currency:EUR)))),query:(language:kuery,query:''))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))

The root of cause is basically _g is not migrated in the migrate_state.ts in Discover.

To Reproduce Steps to reproduce the behavior:

  1. Go to Discover using OSD 2.9 and add some filters & query & timefield then save the url
  2. Go to Discover using OSD 2.11/2.12/2.13/2.14/main and paste the url
  3. See timefield is now-15m

Expected behavior Capture timefield

ananzh avatar May 10 '24 14:05 ananzh