Skip to content

ES|QL CCQ: missing validation for invalid remote indices #121901

@alex-spies

Description

@alex-spies

This came up in #120355 (comment), when @idegtiarenko wanted to improve the grammar for CCQ.

The problem is that invalid cluster names return an empty result without any error message.

Reproducers against a local cluster:

./gradlew run -Dlicense.key=x-pack/license-tools/src/test/resources/public.key -Dtests.es.xpack.license.self_generated.type=trial -Dtests.es.xpack.security.enabled=true

$ curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_cluster/settings" -XPUT -d '
{ "persistent": {
  "cluster": {                                
    "remote" : {
      "cluster_one": { 
        "seeds": ["127.0.0.1:9443"]
      }
    }
  }
}}
'


$ curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_query?format=txt" -d '
{
  "query": "from cluster_one:\"remote:index\""
}'

  <no-fields>  
---------------

$ curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_query?format=txt" -d '
{
  "query": "from cluster_one:remote:index"   
}'
{"error":{"root_cause":[{"type":"parsing_exception","reason":"line 1:24: mismatched input ':' expecting {<EOF>, '|', ',', 'metadata'}"}],"type":"parsing_exception","reason":"line 1:24: mismatched input ':' expecting {<EOF>, '|', ',', 'metadata'}","caused_by":{"type":"input_mismatch_exception","reason":null}},"status":400}%

$ curl -u elastic:password -H "Content-Type: application/json" "127.0.0.1:9200/_query?format=txt" -d '
{
  "query": "from \"cluster_one:remote:index\""
}'

  <no-fields>  
---------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions