The <x>::text inline cast depends on ToString to make the cast, which always returns keyword.
It could make sense in ToString, but a <x>::text cast is expected to return a text.
Reproduce with:
Query:
Result:
{
"columns": [
{
"name": "txt",
"type": "keyword"
}
],
"values": [
[
"txt"
]
]
}
Note that the column type is "keyword".
Another example
Index test with mapping:
{
"text_field": {
"type": "text"
}
}
Query:
FROM test
| eval x = CASE(true, text_field, "txt"::text)
Result:
{
"error": {
"root_cause": [
{
"type": "verification_exception",
"reason": "Found 1 problem line 4:12: third argument of [CASE(true, text_field, \"txt\"::text)] must be [text], found value [\"txt\"::text] type [keyword]"
}
],
"type": "verification_exception",
"reason": "Found 1 problem line 4:12: third argument of [CASE(true, text_field, \"txt\"::text)] must be [text], found value [\"txt\"::text] type [keyword]"
},
"status": 400
}
The
<x>::textinline cast depends onToStringto make the cast, which always returnskeyword.It could make sense in
ToString, but a<x>::textcast is expected to return atext.Reproduce with:
Query:
Result:
{ "columns": [ { "name": "txt", "type": "keyword" } ], "values": [ [ "txt" ] ] }Note that the column type is "keyword".
Another example
Index
testwith mapping:{ "text_field": { "type": "text" } }Query:
Result:
{ "error": { "root_cause": [ { "type": "verification_exception", "reason": "Found 1 problem line 4:12: third argument of [CASE(true, text_field, \"txt\"::text)] must be [text], found value [\"txt\"::text] type [keyword]" } ], "type": "verification_exception", "reason": "Found 1 problem line 4:12: third argument of [CASE(true, text_field, \"txt\"::text)] must be [text], found value [\"txt\"::text] type [keyword]" }, "status": 400 }