How to remove scripted field from displaying in discovery

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

I have created a scripted field in index patterns section for using it in open search visualization. It is coming correctly there. But the issue is that this field is getting displayed in discovery search result as well. I do not want my scripted fields to be displayed in discovery search result, but need it in visualization. How to achieve it

Describe the issue:

Configuration:

Relevant Logs or Screenshots:

Any feedback on this.Appreciate ur help on this

@jinoinfo As far as I can see there is no way to hide scripted field. Once created it will appear in Discovery, Dashboards, Visualisations etc.

Oh ok .
Thanks @pablo for the confirmation.

@pablo : do you know how to remove any field which is part of index or outside of it to remove from display in discover. I know above query was on scripted field.
I want to use one particular field for document level security (dls) to filter the data, but do not want to show that field in discovery search result.
In index patterns, there is a header against each field as ‘excluded’. but i am not seeing any option to set any field to excluded.

@jinoinfo Have you tried FLS?

Hi @pablo
I was able to achieve with the below change in the index
“mappings”: {

 "_source": {
  "excludes": [
    "filter_criteria"
  ]
},

so this field will not be visible to admin/non-admins in either dev tools/discovery or any search we are executing. But if we apply dls like below
“dls”: “{"term": {"filter_criteria": "0847976000040"}}” it works.