Kibana runtime URL field - Use different values for the url template e for the label template

I know this was limitation in the past, but still is?

Its odd to display the full URL as a field label, is there any way to acomplish a label different the URL?

Tks.

Hi @rodrigopaulodecastro, Welcome to the community

If you would like help, we need a little (a lot :slight_smile: ) more detail
Can you provide some additional details, such as:

  • example documents
  • what you are seeing
  • what you want to see
  • What Version of the Stack (Important)

Alright, so I have an idex of gitlab repository files, I would like to have a runtime field type URL for the file name with a link to it on gitlab.

I currently have this script to set the URL value:

def name_src = '';
if (doc['name.keyword'].size() > 0) {
    name_src = doc['name.keyword'].value.replace(' ', '');
} 
def project_src = '';
if (doc['project.keyword'].size() > 0) {
    project_src = doc['project.keyword'].value.replace(' ', '');
}
emit('gitlab/' + project_src + '/-/blob/master/' + name_src);

This is going to be the field URL value compossed by the project e file name, but I need to use just the file name value on the field label.

Example:

URL template:
{{rawValue}}

Label template:
{{doc['name.keyword'].value}}

Tks

Apologies I still do not understand what you mean by this... Field name should not be full URLs ... if that is the case where is that coming from, What is the source of this data

Please provide a source document(s) to test against with the different variations

With
The Before Doc
The Expected After Doc

I did not mention field name. name.keyword refers to gitlab file name and project.keyword refers to gitlab project name. These two informations compose the gitlab URL.

The question is, on the Kibana Discover search results, I want to have a link to the file but display only the file name to be clickable, not the full URL.

Hello @rodrigopaulodecastro

It seems as per the documentation what you are trying to achieve might not be possible.
Label template

To pass unescaped values directly to the URL, use the {{rawValue}} string.
A Label template enables you to specify a text string that appears instead of the raw URL. You can use the {{value}} template string normally in label templates. You can also use the {{url}} template string to display the formatted URL.

Useful link : [Url field formatter] The url template doesn't work as expected · Issue #152542 · elastic/kibana · GitHub

If you had to substitute only 1 value while forming the URL than i think it is possible :

https://www.google.com/?z&no_sw_cr=Eddie

Thanks!!

Thats exactly the problem, yes as per documentation it is not possible. I am giving up on this one. Tks.

Hi @rodrigopaulodecastro

Yes I am afraid you and @Tortoise are correct I tried all my tricks... but yes seem like this is a limitation. Sorry I worked on this last night but fell asleep before I answered :slight_smile:

I tried all sorts of things I was hoping I could use a value from another field but alas not the case...

1 Like

Much apreciated, thank you.