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

[BUG] CSV with filter on nested type fields is empty #375

Open
joshuali925 opened this issue Jul 16, 2024 · 1 comment
Open

[BUG] CSV with filter on nested type fields is empty #375

joshuali925 opened this issue Jul 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joshuali925
Copy link
Member

What is the bug?
CSV with filter on nested type fields is empty

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create index with a nested field
PUT /test_index
PUT /test_index/_mapping
{
  "properties": {
    "tags": {
      "type": "nested",
      "properties": {
        "value": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    }
  }
}

POST /test_index/_doc
{
  "tags": {
    "value": "123"
  }
}
  1. create index pattern for it
  2. go to discover, add filter on tag.value is 123
  3. save the search
  4. create csv report
  5. see it is empty

What is the expected behavior?
csv should have results

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22] main
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
This happens because when discover adds the filter on tag.value, it is stored as

{
  "query": {
    "match_phrase": {
      "tags.value": "123"
    }
  }
}

But it is not correct syntax for a nested field. When discover sends the query, it somehow converts this stored filter into correct nested syntax, so discover search still works

{
  "nested": {
    "path": "tags",
    "query": {
      "match_phrase": {
        "tags.value": "123"
      }
    }
  }
}

Reporting doesn't do this step, it uses the first version directly, leading to no results.

A workaround would be to edit the filter as DSL then paste the correct syntax instead of using UI to add this filter.

@joshuali925 joshuali925 added bug Something isn't working untriaged labels Jul 16, 2024
@dblock dblock removed the untriaged label Aug 5, 2024
@dblock
Copy link
Member

dblock commented Aug 5, 2024

[Catch All Triage - 1, 2, 3]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants