Scripted fields in kibana to elastic?

Hi @umay_fb,

scripted fields are by definition a run-time thing that has to be sent to Elasticsearch with every query. Kibana adds a layer on top of that and remembers to attach them to each request Kibana is making on your behalf. You can't persist them directly as part the Elasticsearch index.

However if you want to persist the values of your script you can do so by defining an ingest pipeline with a script processor: https://www.elastic.co/guide/en/elasticsearch/reference/7.5/script-processor.html

This won't save the script itself, but the computed values in the Elasticsearch index. This also means you have to re-index your data if you ever change your script, but it will be much more efficient while querying data.

There are also search templates which are a similar concept that might help you with your use case.