How to attach a URL to a string in painless

Hey everyone,
I want to create a scripted field with painless that basically does this:

If(doc['field'].value== val){
return("go to site 1");}
Else{return ("go to site 2");}

And I don't see how I can add a hyperlink (an url to my "go to site 1" and" go to site 2")
I Want different url for each case and I don't want the url to show in my dashboard just "go to site 1" and "go to site 2".
Anyone got any idea how I can do this?

You can use the scripted field to return a URL string and string field formatter to format that URL string into an hyper link when rendered.

Thanks for your answer! That's what I was trying to do but it gives me the same label for both URLs and I want to have two different labels that don't have the URLs in them .

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.