Unknown key for a START_OBJECT in [runtime_mappings]

Hi,

I am getting the following error:

upload completely sent off: 426 out of 426 bytes
< HTTP/1.1 400 Bad Request
< content-type: application/json; charset=UTF-8
< content-length: 374
<
{
     “error” : {
          “root_cause” : [
               {
                   “type” : “parsing_exception”,
                    “reason” : “Unknown key for a START_OBJECT in [runtime_mappings].”,
                    “line” : 3,
                   “col” : 23
             }
          ],
     “type” : “parsing_exception”,
     “reason” : “Unknown key for a START_OBJECT in [runtime_mappings].”,
     “line” : 3,
     “col” : 23
},
“status” : 400
}

while executing the following query:

curl -u elastic:ghTn24vWH7qC577T00X6JJa1 -v -H “Content-Type: application/json” -XPOST http://localhost:9200/my)index/_search?pretty=true -d ’
{
     “runtime_mappings”: {
         “duration”: {
             “type”: “long”,
             “script”: {
                  “source”: “emit(doc[‘UpdateDate’].value.toInstant().toEpochMilli() - doc[‘creationDate’].value.toInstant().toEpochMilli())”
               }
         }
     },
     “aggs”: {
         “exec_time_outlier”: {
             “percentiles”: {
                   “field”: “duration”
               }
          }
     },
     “size”: 0
}’

I have been trying to find what I could be doing wrong, but the syntax looks exactly like the sample at the end of this documentation page:

I am using Elasticsearch 7.7.0

Any help appreciated.

Thanks

The guide is for 7.12.0.

You need to upgrade as it's a new feature.

Thanks for the quick response.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.