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] Don't suggest unsupported fields #200544

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

stratoula
Copy link
Contributor

@stratoula stratoula commented Nov 18, 2024

Summary

Closes #189666

Specifically:

  • we do not suggest unsupported fields
  • we add a warning if the field is used in the query

How to test

  1. Create an index with unsupported fields. I used this
PUT my-index-test-unsupported
{
  "mappings" : {
    "properties" : {
      "my_histogram" : {
        "type" : "histogram"
      },
      "my_text" : {
        "type" : "keyword"
      }
    }
  }
}

PUT my-index-test-unsupported/_doc/1
{
  "my_text" : "histogram_1",
  "my_histogram" : {
      "values" : [0.1, 0.2, 0.3, 0.4, 0.5], 
      "counts" : [3, 7, 23, 12, 6] 
   }
}

PUT my-index-test-unsupported/_doc/2
{
  "my_text" : "histogram_2",
  "my_histogram" : {
      "values" : [0.1, 0.25, 0.35, 0.4, 0.45, 0.5], 
      "counts" : [8, 17, 8, 7, 6, 2] 
   }
}
  1. Go to the editor and try the autocomplete, it should not suggest the histogram field
image
  1. Use a query like FROM my-index-test-unsupported | KEEP my_histogram . You should see a warning
image

Checklist

@stratoula stratoula added release_note:enhancement v9.0.0 backport:version Backport to applied version labels v8.17.0 Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana labels Nov 18, 2024
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.4MB 3.4MB +229.0B

@stratoula stratoula marked this pull request as ready for review November 18, 2024 14:38
@stratoula stratoula requested a review from a team as a code owner November 18, 2024 14:38
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

Copy link
Member

@qn895 qn895 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM 🎉

@stratoula stratoula merged commit 3c3f2c1 into elastic:main Nov 18, 2024
29 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11895968089

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
## Summary

Closes elastic#189666

Specifically:

- we do not suggest unsupported fields
- we add a warning if the field is used in the query

### How to test

1. Create an index with unsupported fields. I used this

```
PUT my-index-test-unsupported
{
  "mappings" : {
    "properties" : {
      "my_histogram" : {
        "type" : "histogram"
      },
      "my_text" : {
        "type" : "keyword"
      }
    }
  }
}

PUT my-index-test-unsupported/_doc/1
{
  "my_text" : "histogram_1",
  "my_histogram" : {
      "values" : [0.1, 0.2, 0.3, 0.4, 0.5],
      "counts" : [3, 7, 23, 12, 6]
   }
}

PUT my-index-test-unsupported/_doc/2
{
  "my_text" : "histogram_2",
  "my_histogram" : {
      "values" : [0.1, 0.25, 0.35, 0.4, 0.45, 0.5],
      "counts" : [8, 17, 8, 7, 6, 2]
   }
}
```

2. Go to the editor and try the autocomplete, it should not suggest the
histogram field

<img width="998" alt="image"
src="https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178">

3. Use a query like `FROM my-index-test-unsupported | KEEP my_histogram
`. You should see a warning

<img width="991" alt="image"
src="https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405">

### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 3c3f2c1)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 18, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Don&#x27;t suggest unsupported fields
(#200544)](#200544)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:45:25Z","message":"[ES|QL]
Don't suggest unsupported fields (#200544)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/189666\r\n\r\nSpecifically:\r\n\r\n-
we do not suggest unsupported fields\r\n- we add a warning if the field
is used in the query\r\n\r\n### How to test\r\n\r\n1. Create an index
with unsupported fields. I used this\r\n\r\n```\r\nPUT
my-index-test-unsupported\r\n{\r\n \"mappings\" : {\r\n \"properties\" :
{\r\n \"my_histogram\" : {\r\n \"type\" : \"histogram\"\r\n },\r\n
\"my_text\" : {\r\n \"type\" : \"keyword\"\r\n }\r\n }\r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/1\r\n{\r\n \"my_text\"
: \"histogram_1\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.2,
0.3, 0.4, 0.5], \r\n \"counts\" : [3, 7, 23, 12, 6] \r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/2\r\n{\r\n \"my_text\"
: \"histogram_2\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.25,
0.35, 0.4, 0.45, 0.5], \r\n \"counts\" : [8, 17, 8, 7, 6, 2] \r\n
}\r\n}\r\n```\r\n\r\n2. Go to the editor and try the autocomplete, it
should not suggest the\r\nhistogram field\r\n\r\n<img width=\"998\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178\">\r\n\r\n3.
Use a query like `FROM my-index-test-unsupported | KEEP
my_histogram\r\n`. You should see a warning\r\n\r\n<img width=\"991\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405\">\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"3c3f2c11a9da2a26f75f601ee365af1a227295b6","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.17.0"],"title":"[ES|QL]
Don't suggest unsupported
fields","number":200544,"url":"https://github.com/elastic/kibana/pull/200544","mergeCommit":{"message":"[ES|QL]
Don't suggest unsupported fields (#200544)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/189666\r\n\r\nSpecifically:\r\n\r\n-
we do not suggest unsupported fields\r\n- we add a warning if the field
is used in the query\r\n\r\n### How to test\r\n\r\n1. Create an index
with unsupported fields. I used this\r\n\r\n```\r\nPUT
my-index-test-unsupported\r\n{\r\n \"mappings\" : {\r\n \"properties\" :
{\r\n \"my_histogram\" : {\r\n \"type\" : \"histogram\"\r\n },\r\n
\"my_text\" : {\r\n \"type\" : \"keyword\"\r\n }\r\n }\r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/1\r\n{\r\n \"my_text\"
: \"histogram_1\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.2,
0.3, 0.4, 0.5], \r\n \"counts\" : [3, 7, 23, 12, 6] \r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/2\r\n{\r\n \"my_text\"
: \"histogram_2\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.25,
0.35, 0.4, 0.45, 0.5], \r\n \"counts\" : [8, 17, 8, 7, 6, 2] \r\n
}\r\n}\r\n```\r\n\r\n2. Go to the editor and try the autocomplete, it
should not suggest the\r\nhistogram field\r\n\r\n<img width=\"998\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178\">\r\n\r\n3.
Use a query like `FROM my-index-test-unsupported | KEEP
my_histogram\r\n`. You should see a warning\r\n\r\n<img width=\"991\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405\">\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"3c3f2c11a9da2a26f75f601ee365af1a227295b6"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200544","number":200544,"mergeCommit":{"message":"[ES|QL]
Don't suggest unsupported fields (#200544)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/189666\r\n\r\nSpecifically:\r\n\r\n-
we do not suggest unsupported fields\r\n- we add a warning if the field
is used in the query\r\n\r\n### How to test\r\n\r\n1. Create an index
with unsupported fields. I used this\r\n\r\n```\r\nPUT
my-index-test-unsupported\r\n{\r\n \"mappings\" : {\r\n \"properties\" :
{\r\n \"my_histogram\" : {\r\n \"type\" : \"histogram\"\r\n },\r\n
\"my_text\" : {\r\n \"type\" : \"keyword\"\r\n }\r\n }\r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/1\r\n{\r\n \"my_text\"
: \"histogram_1\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.2,
0.3, 0.4, 0.5], \r\n \"counts\" : [3, 7, 23, 12, 6] \r\n
}\r\n}\r\n\r\nPUT my-index-test-unsupported/_doc/2\r\n{\r\n \"my_text\"
: \"histogram_2\",\r\n \"my_histogram\" : {\r\n \"values\" : [0.1, 0.25,
0.35, 0.4, 0.45, 0.5], \r\n \"counts\" : [8, 17, 8, 7, 6, 2] \r\n
}\r\n}\r\n```\r\n\r\n2. Go to the editor and try the autocomplete, it
should not suggest the\r\nhistogram field\r\n\r\n<img width=\"998\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178\">\r\n\r\n3.
Use a query like `FROM my-index-test-unsupported | KEEP
my_histogram\r\n`. You should see a warning\r\n\r\n<img width=\"991\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405\">\r\n\r\n\r\n###
Checklist\r\n\r\n- [ ] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"3c3f2c11a9da2a26f75f601ee365af1a227295b6"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <[email protected]>
jesuswr pushed a commit to jesuswr/kibana that referenced this pull request Nov 18, 2024
## Summary

Closes elastic#189666

Specifically:

- we do not suggest unsupported fields
- we add a warning if the field is used in the query

### How to test

1. Create an index with unsupported fields. I used this

```
PUT my-index-test-unsupported
{
  "mappings" : {
    "properties" : {
      "my_histogram" : {
        "type" : "histogram"
      },
      "my_text" : {
        "type" : "keyword"
      }
    }
  }
}

PUT my-index-test-unsupported/_doc/1
{
  "my_text" : "histogram_1",
  "my_histogram" : {
      "values" : [0.1, 0.2, 0.3, 0.4, 0.5], 
      "counts" : [3, 7, 23, 12, 6] 
   }
}

PUT my-index-test-unsupported/_doc/2
{
  "my_text" : "histogram_2",
  "my_histogram" : {
      "values" : [0.1, 0.25, 0.35, 0.4, 0.45, 0.5], 
      "counts" : [8, 17, 8, 7, 6, 2] 
   }
}
```

2. Go to the editor and try the autocomplete, it should not suggest the
histogram field

<img width="998" alt="image"
src="https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178">

3. Use a query like `FROM my-index-test-unsupported | KEEP my_histogram
`. You should see a warning

<img width="991" alt="image"
src="https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405">


### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
## Summary

Closes elastic#189666

Specifically:

- we do not suggest unsupported fields
- we add a warning if the field is used in the query

### How to test

1. Create an index with unsupported fields. I used this

```
PUT my-index-test-unsupported
{
  "mappings" : {
    "properties" : {
      "my_histogram" : {
        "type" : "histogram"
      },
      "my_text" : {
        "type" : "keyword"
      }
    }
  }
}

PUT my-index-test-unsupported/_doc/1
{
  "my_text" : "histogram_1",
  "my_histogram" : {
      "values" : [0.1, 0.2, 0.3, 0.4, 0.5], 
      "counts" : [3, 7, 23, 12, 6] 
   }
}

PUT my-index-test-unsupported/_doc/2
{
  "my_text" : "histogram_2",
  "my_histogram" : {
      "values" : [0.1, 0.25, 0.35, 0.4, 0.45, 0.5], 
      "counts" : [8, 17, 8, 7, 6, 2] 
   }
}
```

2. Go to the editor and try the autocomplete, it should not suggest the
histogram field

<img width="998" alt="image"
src="https://github.com/user-attachments/assets/2a9b4594-1f8f-4e7a-9ea3-d9086c770178">

3. Use a query like `FROM my-index-test-unsupported | KEEP my_histogram
`. You should see a warning

<img width="991" alt="image"
src="https://github.com/user-attachments/assets/1bf747da-191f-46e2-b1b8-e5966653f405">


### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:ES|QL ES|QL related features in Kibana release_note:enhancement Team:ESQL ES|QL related features in Kibana v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ES|QL] Enhance experience and transparency for unsupported types in text editor
4 participants