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

Query no matches on .kibana instead of .kibana-devnull #7286

Merged
merged 1 commit into from
Jul 14, 2016

Conversation

epixa
Copy link
Contributor

@epixa epixa commented May 25, 2016

The devnull query was always a big hack to try to force Elasticsearch
into giving us an empty search response when we know there are no
indices that match the current search in the current timeframe. That
hack does not work in all situations, for example if someone creates an
index called .kibana-devnull or doesn't enable access to that index
pattern in shield.

We know users must have access to the kibana index, so it should be safe
to query it, and we know we can force an empty response by doing a
must_not match_all boolean query, so that's what we do here.

Performance shouldn't be an issue since the kibana index is just storing
kibana meta data, configurations, and saved objects.

The devnull query was always a big hack to try to force Elasticsearch
into giving us an empty search response when we know there are no
indices that match the current search in the current timeframe. That
hack does not work in all situations, for example if someone creates an
index called .kibana-devnull or doesn't enable access to that index
pattern in shield.

We know users must have access to the kibana index, so it should be safe
to query it, and we know we can force an empty response by doing a
must_not match_all boolean query, so that's what we do here.

Performance shouldn't be an issue since the kibana index is just storing
kibana meta data, configurations, and saved objects.
@spalger
Copy link
Contributor

spalger commented Jun 22, 2016

LGTM

@spalger spalger assigned epixa and unassigned spalger Jun 22, 2016
@epixa
Copy link
Contributor Author

epixa commented Jun 27, 2016

@tsullivan You mentioned that you removed the .kibana-devnull stuff from monitoring as well. What did you replace it with?

@tsullivan
Copy link
Member

@tsullivan You mentioned that you removed the .kibana-devnull stuff from monitoring as well. What did you replace it with?

The utility that calls fieldStats returns back an array. Previously it did return ['.kibana-devnull']; and now it's just return []; Now we can simply check the length of the set of indices to see if there were no matches, which we couldn't do before.

@epixa
Copy link
Contributor Author

epixa commented Jun 27, 2016

Ah, I see.

@rashidkpc
Copy link
Contributor

Seems like this should work a-ok

@epixa epixa merged commit a9abb0e into elastic:master Jul 14, 2016
@epixa epixa deleted the 7283-kibanadevnull branch July 14, 2016 03:14
@epixa epixa added the v5.0.0 label Oct 26, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
Query no matches on .kibana instead of .kibana-devnull

Former-commit-id: a9abb0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants