summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--specs/pike/default-filters.rst58
1 files changed, 58 insertions, 0 deletions
diff --git a/specs/pike/default-filters.rst b/specs/pike/default-filters.rst
new file mode 100644
index 0000000..fb72019
--- /dev/null
+++ b/specs/pike/default-filters.rst
@@ -0,0 +1,58 @@
1..
2 This work is licensed under a Creative Commons Attribution 3.0 Unported
3 License.
4
5 http://creativecommons.org/licenses/by/3.0/legalcode
6
7===============
8Default filters
9===============
10
11https://blueprints.launchpad.net/searchlight/+spec/overridable-default-filters
12
13This spec is proposed to support cases in plugins where a filter should be
14applied for most searches, but should be overidable by a user.
15
16Problem Description
17===================
18The two cases identified thus far for supporting default (but overridable)
19filters are glance's community images, and nova deleted server instances. In
20both cases there are query clauses that should be applied to searches by
21default, but which a user should be able to explicitly disable.
22
23Proposed Change
24===============
25In addition to RBAC filters which are applied to all queries on a per-plugin
26basis, this change will allow plugins to specify additional filters that will
27be applied by default alongside the RBAC filters. For these defaults, however,
28the query builder will examine the incoming query for any instances of the
29fields that would be filtered on, excluding any filters that the user has
30explicitly specified.
31
32This solution will have some flaws. query_string clauses are by their nature
33difficult to analyze; potentially we can look for instances of ``key:`` after
34splitting on ``&``. For structured queries, looking for instances of the
35filter key in the structured query should be good enough.
36
37In addition, it will be difficult/impossible to know whether a filter should
38be overridden only for specific types (e.g. if ``deleted`` is a default filter
39for the Nova servers plugin, it will be removed for any query including
40``deleted`` as a term even if it wasn't intended to apply to Nova servers).
41
42These limitations are somewhat unavoidable given the flexibility of the
43Elasticsearch DSL. The cases for removing these filters are specific enough
44that edge cases aren't important.
45
46Alternatives
47------------
48None, but this restricts the use of Searchlight for Nova's cells, and the
49ability to match Glance's API with respect to community images.
50
51An alternative implementation option would be a specific option for 'disable
52default filters' at the query top level. This would be safer, more performant,
53more predictable but would require knowledge of these defaults (e.g. that a
54search for ``_type:OS::Nova::Server AND deleted`` won't return anything
55unless the additional override parameter is given).
56
57References
58==========