I couldn't find the details in the documentation, so I hope somebody here will be able to help; I'm curious when the scripted field defined in Kibana is executed? Is it executed on each query, or does Elasticsearch somehow cache the values?
My queries often result with more than 50,000,000 documents, and I have 5 scripted fields defined in the index pattern. The scripted fields consist of bunch of if's on string fields. I'm bit worried that this causes dashboards to be slow at responses.
Is it recommended, in this scenario, to pre-compute fields before inserting data to elastic search, instead of building scripted fields? I do understand that the advantage of scripted field is the ability to update the value for document at any time, although in my case performance is the higher priority.
Thanks a lot, I think you confirmed what I suspected. Do you know if there's a way to persist the result of scripted field so it's only executed when the document is added or cached on the first query, and only re-run the script on demand for existing documents if needed?
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.