Hello,
I am facing an issue when attempting to work with nested fields in a PPL query, as such fields seem to be detected as “undefined” type.
Is there anything to be changed on index mapping and/or ppl logic to interact with such nested fields ?
Versions : OpenSearch 3.7
Describe the issue: Nested fields appear as “undefined” type in the below query, and they cannot be involved in any kind of transformation/reduction
Configuration:
Index mapping is defined as below
{
“my_index”: {
“mappings”: {
“properties”: {
“description”: {
“type”: “text”
},
“id”: {
“type”: “keyword”
},
“name”: {
“type”: “text”
},
“report_columns”: {
“type”: “nested”,
“properties”: {
“label”: {
“type”: “keyword”
},
“name”: {
“type”: “keyword”
},
“position”: {
“type”: “integer”
}
}
}
}
},
“settings”: { <…> }
}
}
Sample document is
{
“_index”: “my_index”,
“_id”: “sample identifier”,
“_source”: {
“id”: “sample identifier”,
“report_columns”: [
{
“name”: “doctype”,
“label”: “Document Type”,
“position”: 1
},
{
“name”: “amount”,
“label”: “Amount”,
“position”: 2
}
],
“name”: “sample name”,
“description”: “sample description”
}
}
PPL Query that reports nested entries as “undefined”
Query
source = my_index
| eval result = transform(report_columns, x → typeof(x))
| fields id, name, result
Result
| id | name | result |
|---|---|---|
| sample identifier | sample name | [“UNDEFINED”, “UNDEFINED”] |
PPL Query that fails interacting with nested entries
Query
source = my_index
| eval result = transform(report_columns, x → concat(x.name, ’ as', x.label, ''))
| fields id, name, result
Error message
ExecutePPLQuery received unexpected status code 500: Cannot create lambda function, Cannot create lambda function
Expected Result
| id | name | result |
|---|---|---|
| sample identifier | sample name | [“docType as Document Type”, “amount as Amount”] |
Relevant Logs or Screenshots: N/A
Kind regards
Denis