How to create a Kibana (Elasticsearch) Scripted Field programatically?
<p>Kibana's UI allows the user to create a scripted field which is stored as part of the index (screenshot below).  How can that be done programatically?  In particular, using either the NEST client or the Elasticsearch low level client.</p>

<p><a href="http://i.stack.imgur.com/Yqrhd.png" rel="noreferrer">Kibana UI for the Indice with the Scripted Fields tab highlighted</a></p>

<p>Note that I am <em>not</em> asking how to create add an expression/script field as part of a query, I'm specifically looking for how to add it as part of the Index when the mapping is created so that queries can reference it without having to explicitly include it.</p>