Kibana: Kibana URL field in index-pattern with relative URL stores the base URL at creation time in the saved object

Created on 18 Apr 2020  路  4Comments  路  Source: elastic/kibana

Kibana version: 7.6.0

Describe the bug:

Relative URLs keep parsedUrl / origin generated at the time of the creation of the index-pattern.

Steps to reproduce:

On a Kibana instance located at https://localhost:5601:

  1. Add the sample data (any kind)
  2. Go to the index-pattern settings
  3. Edit one of the text field to be formatted as Url and specify a relative URL (e.g. /some/file.png)
  4. Save
  5. Snapshot the .kibana* indices
    On another cluster (e.g. another environment), with Kibana instance located at https://dev.comp.com:5601 (server.host: dev.comp.com in kibana.yml):
  6. Restore the .kibana* indices
  7. All works fine, except the the fact the field edited on step (3) will still point to https://localhost:5601

Expected behavior:

The "base" URL should not be stored in the index-pattern.

Provide logs and/or server output (if relevant):

GET .kibana/_doc/index-pattern:90943e30-9a47-11e8-b64d-95841ca0b247?filter_path=_source.index-pattern.fieldFormatMap
# Response
{
  "_source" : {
    "index-pattern" : {
      "fieldFormatMap" : """{"url.keyword":{"id":"url","params":{"parsedUrl":{"origin":"https://localhost:5601","pathname":"/app/kibana","basePath":""},"urlTemplate":"/some/param.png"}},"url":{"id":"url","params":{"parsedUrl":{"origin":"https://localhost:5601","pathname":"/app/kibana","basePath":""},"urlTemplate":"/some/param.png"}}}"""
    }
  }
}

Any additional context:

From our Discuss forum https://discuss.elastic.co/t/kibana-url-template-with-relative-path/228418/5

Workaround:

One of the following applies:
1) Patch the Kibana object by import / export
2) Patch the Kibana index-pattern object in the .kibana index
3) Edit the index-pattern, switch to the default type, save, then add the Url type back

FieldFormatters Index Patterns AppServices bug discuss medium days triaged

All 4 comments

Pinging @elastic/kibana-app-arch (Team:AppArch)

There is a similar problem when importing saved objects: all the URLs will use the name of the old instance.
(I'm using kibana 7.6.1)

Briefly looked at this; instantiating a new field formats service will use the current value from window.location for the parsedUrl fields, but when reading a format from a saved object we will just use whatever values are stored there.

How we want to address this will need further discussion -- I'm actually not clear why we _need_ to store the parsedUrl.origin in the first place when it seems to me the desired behavior would always be to include the current origin, and just have the stored path & template.

Any way to prioritize a fix for this? We have 12 clusters and Kibana objects have to be kept in sync across each of them. This bug is a major pain point right now.

Was this page helpful?
0 / 5 - 0 ratings