I have a query like this and although /_sql endpoint return correct results. /_sql/translate only return fields that use in query, without calculation
POST /_sql/translate
{
"query": "SELECT Broker,IssueCount,Splits,CASE WHEN LCASE(Broker) LIKE '%kgh%' THEN IssueCount/2 ELSE Splits END AS TungTran,DATEDIFF('hour', S3_3, Created) AS DateDiff FROM projects_dev",
"fetch_size": 10
}
result from translate api:
{
"size": 10,
"_source": false,
"fields": [
{
"field": "Broker"
},
{
"field": "IssueCount"
},
{
"field": "Splits"
},
{
"field": "S3_3",
"format": "strict_date_optional_time_nanos"
},
{
"field": "Created",
"format": "strict_date_optional_time_nanos"
}
],
"sort": [
{
"_doc": {
"order": "asc"
}
}
],
"track_total_hits": -1
}
I expected case when field will be convert in to some painless script or something else. Please give any suggestion.