- 
                Notifications
    
You must be signed in to change notification settings  - Fork 25.6k
 
Open
Labels
:Search Relevance/ES|QLSearch functionality in ES|QLSearch functionality in ES|QL>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch
Description
If a column is NULL, FUSE fails with:
{
    "error": {
        "root_cause": [
            {
                "type": "esql_illegal_argument_exception",
                "reason": "illegal data type [null]"
            }
        ],
        "type": "esql_illegal_argument_exception",
        "reason": "illegal data type [null]"
    },
    "status": 500
}
Reproduction:
POST my-index/_doc
{
    "id": "park_rocky-mountain",
    "title": "Rocky Mountain",
    "description": "Bisected north to south by the Continental Divide, this portion of the Rockies has ecosystems varying from over 150 riparian lakes to montane and subalpine forests to treeless alpine tundra."
}
POST _query?format=txt
{
  "query": """
FROM my-index METADATA _id, _index, _score | 
EVAL input = null | 
EVAL tm = CASE(input is NULL, \"\", input) | WHERE tm==\"\" OR MATCH(title, tm) | 
FORK 
  (WHERE title:\"rocky\" | SORT _score DESC)
  (WHERE description:\"rocky\" | SORT _score DESC) | 
FUSE | 
LIMIT 10
"""
}
Dropping the NULL column before FUSE solves the issue:
POST _query?format=txt
{
  "query": """
FROM my-index METADATA _id, _index, _score | 
EVAL input = null | 
EVAL tm = CASE(input is NULL, \"\", input) | WHERE tm==\"\" OR MATCH(title, tm) | 
FORK 
  (WHERE title:\"rocky\" | SORT _score DESC)
  (WHERE description:\"rocky\" | SORT _score DESC) | 
DROP input
FUSE | 
LIMIT 10
"""
}
Metadata
Metadata
Assignees
Labels
:Search Relevance/ES|QLSearch functionality in ES|QLSearch functionality in ES|QL>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearch