Scripted URL field of optional field

Some of my logs/documents contain request information, and one of the fields is message.request_id, so that field does not exist on every document.

What I want to achieve is to add a Scripted Field of URL type, that'll lead to logs and filter logs by that request-id, basically linking to an immediately filtered log where I can see all the logs related to the particular request. The main reason why I want is to use the field in the data table.

The issue is that I'm new to Scripted Fields and in my case, after I create that custom field I can't see. any logs.

Here is how I'm creating that field:

In the Discovery section, I can see that newly created field, but all other index-related fields are gone and no document is displayed.

What I'm doing wrong?

Hi @Bohdan_Dubyk! Welcome to the community!

What Kibana version are you using?

Scripted fields are deprecated. The recommended way is to create runtime fields (from Discover or Data View pages). They have similar syntax but for runtime script the final value should be wrapped with emit(<your value>) function instead of just return.

If this field was not set for a document, please consider using the following check rather than checking for null:

if (doc["message.request_id"].size() > 0) {
...
}

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