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

Table doesn't apply queries properly #8

Open
mikapp opened this issue Nov 3, 2017 · 3 comments · May be fixed by #9
Open

Table doesn't apply queries properly #8

mikapp opened this issue Nov 3, 2017 · 3 comments · May be fixed by #9

Comments

@mikapp
Copy link

mikapp commented Nov 3, 2017

Hi, thanks a lot for your work! I tried your kibana3 fork with the latest ES 5.6 and it works great. However I noticed that table doesn't apply queries the same way as other panels e.g. if you add new query all panels will render results according to the query but not table panel. Table will have query related results in the top followed by all other docs making it up to 500 (default limit). It works fine with filters though, just not with queries.
I can probably have a look too and send you a pul request just let me know where to start.
Thanks!

@mikapp
Copy link
Author

mikapp commented Nov 3, 2017

Here are JSONs from inspect field for table panel in both original Kibana 3 and this fork so it might help to see why it behaves differently:

Original Kibana with ES 1.7

"query": {
    "filtered": {
      "query": {
        "bool": {
          "should": [
            {
              "query_string": {
                "query": "*"
              }
            }
          ]
        }
      },
      "filter": {
        "bool": {
          "must": [
            {
              "range": {
                "@timestamp": {
                  "from": 1509732179320,
                  "to": 1509735779320
                }
              }
            }
          ]
        }
      }
    }
  },
  

Custom Kibana3 with ES 5.6

"query": {
    "bool": {
      "filter": [
        {
          "range": {
            "@timestamp": {
              "from": 1509715711095,
              "to": 1509737311095
            }
          }
        },
        {
          "range": {
            "@timestamp": {
              "from": 1509720759162,
              "to": 1509721934842
            }
          }
        }
      ],
      "should": [
        {
          "query_string": {
            "query": "*"
          }
        }
      ]
    }
  },

@jammann
Copy link

jammann commented Nov 15, 2017

Also from me: thanks for the excellent work! This bug here (which I think is a dupe of #4) disturbs me. I think I found the reason. It's happening (for me) always when I have both QUERY and FILTER restrictions - which is almost always the case

Panels work because there the QUERY parts from Kibana is applied with a SHOULD in the ES query, while the FILTER parts are applied as filtered aggregations to the aggs themselves

In the table however the part from Kibana FILTER and QUERY are applied within one big bool filter. And per the documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html a SHOULD term in such a combination is only used for scoring, but not really for filtering

I will try to come up with a pull request

@jammann jammann linked a pull request Nov 17, 2017 that will close this issue
@mikapp
Copy link
Author

mikapp commented Dec 11, 2017

@jammann I forked your branch with fixes and it works fine for me. Table now only shows data from query as expected. Thanks for addressing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants