In some cases, it might be necessary to analyze the relationship of fields within documents. Elasticsearch gives us the ability to create scripted fields (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html) that allow us to programmatically combine individual fields into new fields; ML can then leverage that!
For example, let's say you have daily documents that summarize your product sales and that your documents have two fields, Amount and Count:
{ ... "Count": 160, "Amount": 7200 ... }
We could easily define a use case in which we were interested in the per item cost (Amount/Count). To do so, we would define the ML job to focus on the new field (perhaps we'll call it per_item_cost and use the mean function on it):
PUT _xpack/ml/anomaly_detectors/my_job { "...