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

Unable to do a nested query on saved objects using KQL #51637

Closed
mikecote opened this issue Nov 25, 2019 · 2 comments
Closed

Unable to do a nested query on saved objects using KQL #51637

mikecote opened this issue Nov 25, 2019 · 2 comments
Assignees
Labels
Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@mikecote
Copy link
Contributor

I'm having a hard time creating a nested query with KQL using the saved objects API. I keep getting a This key 'actionTypeId' need to be wrapped by a saved object type like alert: error on the nested query.

Steps to reproduce:

  1. Enable alerting in your kibana.yml config xpack.actions.enabled: true and xpack.alerting.enabled: true.
  2. Adjust and run following curl command curl -X GET 'http://elastic:changeme@localhost:5603/api/saved_objects/_find?type=alert&filter=alert.attributes.actions%3A%7B%20actionTypeId%3A%20%22.server-log%22%20%7D'.
  3. Note error returned from API.

Saved object mapping:

{
  "alert": {
    "properties": {
      ...
      "actions": {
        "type": "nested",
        "properties": {
          "group": {
            "type": "keyword"
          },
          "actionRef": {
            "type": "keyword"
          },
          "actionTypeId": {
            "type": "keyword"
          },
          "params": {
            "enabled": false,
            "type": "object"
          }
        }
      }
    }
  }
}

GET /api/saved_objects/_find query:

{
  type: 'alert',
  filter: 'alert.attributes.actions:{ actionTypeId: ".server-log" }',
}

Error message:

{"message":"This key 'actionTypeId' need to be wrapped by a saved object type like alert: Bad Request","statusCode":400,"error":"Bad Request"}
@mikecote mikecote added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Saved Objects labels Nov 25, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@mikecote
Copy link
Contributor Author

mikecote commented Dec 4, 2019

Solved by #51847, thank you @XavierM for looking into this!

@mikecote mikecote closed this as completed Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants