Unable to parse correctly a filter as part of a custom URL when field values contain apostrophe characters

Hi Everyone,

I’m struggling to create a link (from a table visualization) to a drill-down dashboard using scripted fields with the URL format template. This is the following:

s/my_kibana_space/app/kibana#/dashboard/c2dd0590-695a-11eb-84f5-1b2d4b2af8d6?_g=(refreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow%2Fd%2Cto%3Anow%2Fd))&_a=(filters:!((query:(match_phrase:(dt:'{{value}}')))))

The field “dt” represents a news headline/title from a news website. This URL perfectly works except when the field value contains an apostrophe like, for example, the following headline:

“MasterChef Celebrity: Jorge Lanata cuestionó la participación de María O'Donnell

The resulting URL with this example is:

https://realtime.com.ar/s/my_kibana_space/app/kibana#/dashboard/c2dd0590-695a-11eb-84f5-1b2d4b2af8d6?_g=(refreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow%2Fd%2Cto%3Anow%2Fd))&_a=%28filters%3A%21%28%28query%3A%28match_phrase%3A%28dt%3A%27MasterChef%20Celebrity%3A%20Jorge%20Lanata%20cuestion%C3%B3%20la%20participaci%C3%B3n%20de%20Mar%C3%ADa%20O'Donnell%27%29%29%29%29%29

In this case, Kibana shows the message: “Unable to parse URL” and doesn’t apply the filter needed.

I managed to parse correctly the URL replacing the apostrophe ' with ‘ (and other similar characters), but the value doesn't match (I suppose this is the expected behavior).

Is there an alternative way to create the custom URL with the apostrophe? I tried using double quotes but it didn't work. Is it possible to use any other character as a synonym for ' ?

Just in the case that it could be useful, I leave the mapping definition for the field dt below:

    "dt" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              },
              "fielddata" : true
            }

I know that in newer versions of Elastic/Kibana there’s a straightforward way to create a drill-down dashboard, but at the moment we have 7.6.2 and I need to solve that issue in this version. I look forward to working with the latest version soon.

Regards,
Gerardo

Hey @Gerardo_Marcotrigian,

I believe the single-quote will be escaped correctly if you prepend it with !, for example !'.

So, O'Donnell would become O!'Donnell.

Can you give that a try and let me know how it works?

Brian

@brianseeders. That works perfectly!
Thank you so much for your support :smiley:
Regards,
Gerardo

1 Like

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