Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES|QL] Column verification happens before index filtering #113093

Closed
dgieselaar opened this issue Sep 18, 2024 · 2 comments
Closed

[ES|QL] Column verification happens before index filtering #113093

dgieselaar opened this issue Sep 18, 2024 · 2 comments
Assignees
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@dgieselaar
Copy link
Member

In ES|QL, column verification happens before index filtering. For instance, if I exclude the frozen tier or add a time range filter, ES|QL will still complain about column type mismatches in indices that do not have data for the query. This is unhelpful in cases where e.g. data streams have been rolled over with type changes and old backing indices break a query that only hits recent data. Here's a reprod:

PUT my-index-old
{
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "keyword_or_number": {
        "type": "keyword"
      }
    }
  }
}

PUT my-index-new
{
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "keyword_or_number": {
        "type": "byte"
      }
    }
  }
}

POST my-index-old/_doc
{
  "@timestamp": "2024-01-01T00:00:00.000Z",
  "keyword_or_number": "my_text"
}

POST my-index-new/_doc
{
  "@timestamp": "2024-09-18T09:19:16.409Z",
  "keyword_or_number": 10
}

// returns only keyword_or_number of type byte

POST my-index*/_field_caps?fields=*&filter_path=fields.@timestamp*,fields.keyword_or_number*
{
  "index_filter": {
    "range": {
      "@timestamp": {
        "gte": "2024-02-01T00:00:00.000Z"
      }
    }
  }
}

// breaks with a `verification_exception`

POST _query
{
  "query": """
    FROM my-index*
      | STATS BY keyword_or_number
  """,
  "filter": {
    "range": {
      "@timestamp": {
        "gte": "2024-02-01T00:00:00.000Z"
      }
    }
  }
}

// "just works"

POST my-index*/_search
{
  "query": {
    "bool": {
      "filter": {
        "range": {
          "@timestamp": {
            "gte": "2024-02-01T00:00:00.000Z"
          }
        }
      }
    }
  },
  "aggs": {
    "group": {
      "terms": {
        "field": "keyword_or_number"
      }
    }
  }
}
@dgieselaar dgieselaar added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 18, 2024
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label and removed Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Sep 18, 2024
@bpintea bpintea added >enhancement :Analytics/ES|QL AKA ESQL and removed needs:triage Requires assignment of a team area label labels Sep 18, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 18, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@astefan
Copy link
Contributor

astefan commented Dec 5, 2024

This should now be possible with #116755, which is addressing #115053.

@astefan astefan closed this as completed Dec 5, 2024
@astefan astefan self-assigned this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

4 participants