Kibana scripted field: doc['some_field'] doesnt work when the field has a lot of data

Just forgot to add, I've seen some people with the same issue as me, in the following topics:
https://discuss.elastic.co/t/scripted-field-read-field-data-from-a-document-using-doc-some-field-value-return-null-in-some-cases/187385/8