elastic-builder icon indicating copy to clipboard operation
elastic-builder copied to clipboard

Support lang and params in RuntimeField script for runtime_mappings

Open alejokf opened this issue 10 months ago • 1 comments

Currently, RuntimeField does not support the lang and params fields inside the script for runtime_mappings, but this is supported by Elasticsearch.

Example:

{
  "runtime_mappings": {
    "measure": {
      "type": "long",
      "script": {
        "lang": "painless",
        "source": "emit(doc['measure'].value * params.factor);",
        "params": {
          "factor": 2
        }
      }
    }
  },
  "aggs": {
    "measure": {
      "terms": {
        "field": "measure"
      }
    }
  }
}

Ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-mapping-fields.html

alejokf avatar Apr 18 '24 15:04 alejokf

I opened a PR with the fix: https://github.com/sudo-suhas/elastic-builder/pull/202

alejokf avatar Apr 18 '24 15:04 alejokf