Open
Description
Elasticsearch version
6.5.4 and above
Plugins installed: []
JVM version
1.8.0, jdk10, jdk11, jdk12
OS version
linux
Description of the problem including expected versus actual behavior:
When using painless execution API, documents with nested field types are empty
Steps to reproduce:
curl -X PUT "localhost:9200/test0" -H 'Content-Type: application/json' -d'
{
"mappings" : {
"_doc" : {
"properties" : {
"field0": {"type": "long"},
"field1" : { "type": "nested",
"properties": {
"nested1": {
"type": "integer"}
}
}
}
}
}
}
curl -X PUT "localhost:9200/test0/_doc/1" -H 'Content-Type: application/json' -d'
{
"field0" : 12, "field1": [{"nested1":1}]
}
'
curl -X POST "localhost:9200/_scripts/painless/_execute" -H 'Content-Type: application/json' -d'
{
"script": {
"source": "return doc[\"field0\"].value ",
"params": {
"number": 1
}
},
"context_setup": {
"index": "test0",
"document": {
"field0": 3,
"field1": [
{
"nested1": 2
}
]
}
},
"context": "score"
}
'
{"result":0.0}
It was expected to have result 3 instead of 0