ppadovani / KibanaNestedSupportPlugin

A plugin for Kibana 5.5 and beyond that adds support for nested field search and aggregation.
https://ppadovani.github.io/knql_plugin/overview/
Apache License 2.0
79 stars 7 forks source link

Problem filtering nested fields on Dashboard #72

Closed lelwar closed 6 years ago

lelwar commented 6 years ago

Plugin version: 1.0.0 Kibana version: 5.68 Plugins installed: None other Description of the problem including expected versus actual behavior:

I have encountered a problem when doing drill downs in the graph. I have found that when you do a drill down using a non nested field, it works flawlessly. This is not the case in using drilldown with nested fileds, since it give 0 results.

I have also tried making my own filter for nested fields:


{
  "query": {
    "nested": {
      "path": "userClicks",
      "query": {
        "bool": {
          "must": {
            "term": {
              "userClicks.name.alias": "someName"
            }
          }
        }
      }
    }
  }
}

```In this filter I am trying to filter so that the graph show only the userClicks that correspond to an alias of "someName". When I apply the filter, it still shows userClicks that do not correspond to the alias "someName". What I find strange is that if I use the invert feature on the kibana GUI it actually works! That is if I use invert on the above query filter, it will show me all userClicks except "someName" (meaning that the filter works using invert).

After watching this behavior I tried the opposite filter to see how it worked:
`{
  "query": {
    "nested": {
      "path": "userClicks",
      "query": {
        "bool": {
          "must_not": {
            "term": {
              "userClicks.name.alias": "someName"
            }
          }
        }
      }
    }
  }
}
`
Again if I run this filter it should give me all userClicks that do not contain "someName" alias, but it doesn't work because it shows me userClicks that contain "someName". But when I use the invert funcionality in kibana it works with no problem. Meaning that using the above filter with invert only shows me the userClicks that have "someName" alias.

**Steps to reproduce**:
 1.Create nested documents with 2 levels of nesting.
 2. Create different visualizations and add them to the dashboard.
 3. Use drill down by clicking on a nested field.
 4. Use a filter like the one above.
ppadovani commented 6 years ago

This seems to be working in 6.2.4 and could be something specific to the 5.6.X version of the plugin. I'm in the process of fixing a few things in the 6.x stream that I'll be back-porting to the 5.x series.. I'll work on this when I back port the current set of fixes.

ppadovani commented 6 years ago

I'm in the process of back porting to 5.6.9 and resolving issues related to that... I will look at this as part of that work. Just wanted to let you know I haven't forgotten this...

ppadovani commented 6 years ago

I have just tried this with 5.6.9 and my regression dashboard that uses my scripts to populate nested data... the data is formatted like homes->cars[]->options[]

When I click through on an option in a pie chart, the behavior is as expected, and the following filter is created: { "query": { "nested": { "path": "cars.options", "query": { "match": { "cars.options.name": { "query": "V6", "type": "phrase" } } } } } }

The results may seem confusing since I see more than just V6 options in the result. I also see other options... and this is because these other options are part of an array of options associated with a car associated with the parent home document. If a match exists to any single nested object, then the entire parent document is used in the aggregation.

I'll continue to play with this as I get closer to releasing 5.6.9 and starting the back-port to 5.6.8.

ppadovani commented 6 years ago

I believe this problem may be resolved.. please grab the latest release and verify.

ppadovani commented 6 years ago

Please reopen if this is still an issue.